Home  >  Q&A  >  body text

Want to know the actual usage of Math.max

Math.max(1,2,3,4,5) What I want to know is how I can get and use this (1,2,3,4,5).

For example:

var a = [1,2,3,4,5]

var b = Math.max(a)

NaN

I want to use Math.max to get

小朋友小朋友2351 days ago1743

reply all(1)I'll reply

  • 威尼斯

    威尼斯2018-05-14 09:31:17

    var a = [1,2,3,4,5];

    var b = Math.max(...a);

    es6 extended operator , you can go to Baidu to find out

    reply
    0
  • Cancelreply