How to convert strings in array to floats in Node.js

1 Answer

0 votes
const array = ['133.14', '-312.89', '247.13', '5512.45'];

const numbers = array.map(Number);

console.log(numbers);
 
 
 
 
/*
run:
 
[ 133.14, -312.89, 247.13, 5512.45 ]
 
*/

 



answered Jun 6, 2022 by avibootz

Related questions

...