I want to store an Array like this
const price = [ 1.000, 24.500, 3.99, 4.00 ];
but when i'm print this with console.log, the 1.000 becomes 1 , the 4.00 become 4.
how to keep the thousand number with dot separator?
I want to store an Array like this
const price = [ 1.000, 24.500, 3.99, 4.00 ];
but when i'm print this with console.log, the 1.000 becomes 1 , the 4.00 become 4.
how to keep the thousand number with dot separator?
Try the following code:
console.log(price.toFixed(3));
prices.forEach((price)=>{ console.log(price.toFixed(3)); })
let truePrice = prices.map( (price)=> price.toFixed(3) )