EN
JavaScript - convert integer array to string array
0 points
In this article, we would like to show you how to convert an array of numbers to an array of strings in JavaScript.
Quick solution:
xxxxxxxxxx
1
const numbers = [1, 2, 3];
2
const strings = numbers.map(String);
3
4
console.log(JSON.stringify(numbers)); // [1,2,3]
5
console.log(JSON.stringify(strings)); // ["1","2","3"]
Warning:
This solution will also convert boolean values into strings.