Math Extensions
in-built mathematical functions in ES6
We'll cover the following...
We'll cover the following...
The Number and the Math objects have been extended with many useful methods. There are many new mathematical functions in ES6.
In my opinion, the most useful and semantic addition is Math.trunc, which gives you the truncated integer value of a number.
Node.js
console.log(Math.trunc( 1.99 ));console.log(Math.trunc( -1.99 ));
Another extension is Math.sign which gives you the sign of a number. Even though the > and < ...