ES6 - Funzione Math Abs ()
Questo metodo restituisce il valore assoluto di un numero.
Sintassi
Math.abs( x ) ;Parametro
- X: rappresenta un numero
Valore di ritorno
Restituisce il valore assoluto di un numero
Esempio
console.log("---Math.abs()---") 
console.log("Math.abs(-5.5) : "+Math.abs(-5.5)) 
console.log("Math.abs(5.5) : "+Math.abs(5.5))Produzione
---Math.abs()--- 
Math.abs(-5.5) : 5.5 
Math.abs(5.5) : 5.5