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 200 views
1 answer 203 views
1 answer 240 views
1 answer 201 views
201 views asked Aug 27, 2022 by avibootz
...