Skip to content

Instantly share code, notes, and snippets.

@gokusenz
Created September 14, 2017 12:38
Show Gist options
  • Save gokusenz/e24079092b149e7e91136a2cb5852e2e to your computer and use it in GitHub Desktop.
Save gokusenz/e24079092b149e7e91136a2cb5852e2e to your computer and use it in GitHub Desktop.
Javascript Example Test
const lookupTaxRate = (region) => {
if(region == '') {
throw 'Region can\'t be blank!'
}
var taxRate = 0.5
if(region == 'Chiang Mai') {
taxRate = 0.4
}
if(region == 'Bangkok') {
taxRate = 0.3
}
if(region == 'Phuket') {
taxRate = 0.2
}
if(taxRate <= 0.3) {
taxRate = 0
}
return taxRate
}
console.log(lookupTaxRate("Bangkok"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment