Created
April 22, 2018 13:51
-
-
Save GitHub30/57281870266f1147b05f0d114cd7f804 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var conditions = [{lt: 10000, tax: 0}, {ge: 10000, lt: 15000, tax: 100}, {ge: 15000, lt: 20000, tax: 200}, {ge: 20000, tax: 300}]; | |
function accommodationTax(charge){ | |
for(var condition of conditions){ | |
if((!condition.ge || charge >= condition.ge) && (!condition.lt || charge < condition.lt)){ | |
return condition.tax; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment