javaScript 学习零散笔记(1) ---- 获取数组中最大值/最小值

{
    let x1 = 21;
    let x2 = 5;
    let x3 = 99;
    let x4 = 2;
    let list = [x1,x2,x3,x4];
    var result = Math.max(...list);
    console.log('max value == ' + result);
}

{
    let x1 = 21;
    let x2 = 5;
    let x3 = 99;
    let x4 = 2;
    let list = [x1,x2,x3,x4];
    var result = Math.min(...list);
    console.log('max value == ' + result);
}

你可能感兴趣的:(ES6)