function check(a, b, c) {
if (a + b === c) return true;
if (a + c === b) return true;
if (b + c === a) return true;
return false;
}
console.log(check(0, 1, 2));
console.log(check(1, 2, 3));
function checkNumber(a, b, c) {
if (a + b === c) return true;
else-if (a + c === b) return true;
else-if (b + c === a) return true;
return false;
}
console.log(check(0, 1, 2));
console.log(check(1, 2, 3));
如果只有三个数字,简单的手动迭代就足够了: