Numbers


There is no distinction between integers and decimals.

var myInteger = 20; 
var myDecimal = 5.55;


All numbers are floating point
so decimal fractions are not exact.
standard operators +, -, *, /, %
parseFloat - converts a string to a number


number value Data Type



Number Object




Methods

toFixed(n) - returns the number to n decimal places


let number1 = parseInt("11 two 33"); 
let number2 = parseFloat("22 three 44");
let number3 = 11.234.toFixed(0);
let number4 = 100.6.toFixed(2);



© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopNext