📜  在 Javascript 代码示例中按函数查找最小数

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

代码示例4
function smallestNumber(first, second, third) {
    if (first < second && first < third) {
        return first;
    } else if (second < first && second < third) {
        return second;
    } else {
        return third;
    }
}
const num1 = 100;
const num2 = 120;
const num3 = 80;
console.log(smallestNumber(num1, num2, num3));
//Output: 80