只允许使用 + - * / 和 Math. ,求一个函数 y = f(x, a, b);
当 x > 100 时返回 a 的值,否则返回 b 的值,
不能使用 if else 等条件语句,也不能使 用 |,?:,数组。*
function f(x, a, b) {
var temp = Math.ceil(Math.min(Math.max(x - 100, 0), 1));
return a * temp + b * (1 - temp);
}
console.log(f(-10, 1, 2));