📌  相关文章
📜  js 检查哪个数字更大 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:34.410000             🧑  作者: Mango

代码示例1
//Which number is larger
function whichIsLarger(num1 , num2){
    return num1 > num2 ? 'num1': num1 < num2 ? 'num2' : 'neither';
}

console.log(whichIsLarger(10, 8)); //num1
console.log(whichIsLarger(11, 11));//neither
console.log(whichIsLarger(-1, 5)); //num2