不知道问这个问题的最佳方式是:
我正在编写一个函数,它将接受一个名为“x”的变量。
function doIt(x){
var y = someformula; //this is just a placeholder for the correct formula
return y;
}
这是我期望返回的:
if (x is between 0 and 9){ y = 0; }
if (x is between 10 and 19){ y = 32; }
if (x is between 20 and 29){ y = 64; }
if (x is between 30 and 39){ y = 96; }
等等....
任何帮助表示赞赏。
如果重要的话,我会用 JavaScript 来做。