Skip to content

Instantly share code, notes, and snippets.

@DevGW
Last active April 5, 2023 14:40
Show Gist options
  • Save DevGW/c2e2620006d5808a5a97a799a128a428 to your computer and use it in GitHub Desktop.
Save DevGW/c2e2620006d5808a5a97a799a128a428 to your computer and use it in GitHub Desktop.
Javascript :: using return #js
function taxCalculator(price, state) {
if (state === 'NY') {
return price + price*0.04;
} else if (state === 'NJ') {
return price + price*0.06625;
}
}
function greeting(name) {
if (name !== undefined) {
return `Hello ${name}!`;
} else {
return 'Hello!';
}
}
function doYouPlayTheTheremin(name) {
if (name[0] === 's' || name[0] === 'S') {
return true;
} else {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment