How to convert array of numbers to array of strings in Node.js

1 Answer

0 votes
const arr = [ 999, 12, 87, 99, 4 ]

const arrOfStrings = arr.map(num => { return String(num); });

console.log(arrOfStrings); 

console.log(typeof arrOfStrings[0]); 

  
  
  
  
/*
run:
  
[ '999', '12', '87', '99', '4' ]
string
  
*/

 



answered Jun 21, 2022 by avibootz

Related questions

1 answer 102 views
1 answer 112 views
1 answer 147 views
1 answer 124 views
124 views asked Aug 27, 2022 by avibootz
...