ES6 - Fonction Math max ()

Cette méthode renvoie le plus grand de zéro ou plusieurs nombres. Si aucun argument n'est donné, le résultat est –Infinity.

Syntaxe

Math.max(x1,x2,x3..)

Paramètre

  • X1, x2, x3 .. - représente une série de nombres

Exemple

console.log("---Math.max()---") 
console.log("Math.max(3, 0.5, 0.66) : "+Math.max(3, 0.5, 0.66)) 
console.log("Math.max(-3, 0.5, -0.66) : "+Math.max(-3, 0.5, -0.66))

Production

---Math.max()--- 
Math.max(3, 0.5, 0.66) : 3 
Math.max(-3, 0.5, -0.66) : 0.5