Open bingqing46 opened 5 years ago
function min(arg, arg1) { if(arg - arg1 > 0) { return arg1; }else{ return arg; } } console.log(min(0, 10)); // → 0 console.log(min(0, -10)); // → -10
官方答案
function min(a, b) { if (a < b) return a; else return b; } console.log(min(0, 10)); // → 0 console.log(min(0, -10)); // → -10