Convert Array of Numbers to Array of Strings in JavaScript-Code Examples

Victor Talmacinschi

Convert Array of Numbers to Array of Strings in JavaScript

JavaScript by Victor Talmacinschi June 21, 2022

const numbers = [1, 2, 3, 4, 5];
// map numbers to their string representation
const strings = numbers.map(String);

console.log(strings); // ['1', '2', '3', '4', '5']

0

18.038

Convert Array of Numbers to Array of Strings in JavaScript

JavaScript by Victor Talmacinschi June 21, 2022

const numbers = [1, 2, 3, 4, 5];

// map numbers to strings
const strings = numbers.map(number => String(number));

console.log(strings); // ['1', '2', '3', '4', '5']

0

18.038

Related JavaScript Queries

Latest JavaScript Queries

Explore code examples by categories