Skip to content

Instantly share code, notes, and snippets.

@KamaKAzii
Created May 29, 2011 03:32
Show Gist options
  • Save KamaKAzii/997441 to your computer and use it in GitHub Desktop.
Save KamaKAzii/997441 to your computer and use it in GitHub Desktop.
var calcIndividual = function (input) {
if (input < 6001) {
var output = 0;
}
if (6000 < input < 35001) {
var output = ((input - 6000) * 0.15);
}
if (35000 < input < 80001) {
var output = (4350 + ((input - 35000) * 0.3));
}
if (80000 < input < 180001) {
var output = (17850 + ((input - 80000) * 0.38));
}
if (input > 180000) {
var output =(55850 + ((input - 180000) * 0.45));
}
return output;
};
Copy link

ghost commented May 29, 2011

Number.prototype.between = function(a, b) {
    return (this >= a && this <= b) ? true : false;
}
alert(new Number(10).between(5, 7)); // false

@jsok
Copy link

jsok commented May 29, 2011

You have bugs. The values 6000, 35000, 80000 and 180000 will return bogus output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment