Skip to content

Instantly share code, notes, and snippets.

@jfrites
Last active January 3, 2020 00:18
Show Gist options
  • Save jfrites/a67810c106bd39a68aba03edddb9c38f to your computer and use it in GitHub Desktop.
Save jfrites/a67810c106bd39a68aba03edddb9c38f to your computer and use it in GitHub Desktop.
Switch Statement JS Example
const taxCalulator = (amount, state) => {
switch (state) {
case "NY":
return amount * 1.04;
case "NJ":
return amount * 1.0625;
default:
return amount;
}
};
console.log(taxCalulator(100, "NJ"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment