Categories
JavaScript Answers

How to convert integer array to string array in JavaScript?

Spread the love

To convert integer array to string array in JavaScript, we call the map method.

For instance, we write

const sphValues = [1, 2, 3, 4, 5];
const mapped = sphValues.map(String);

to call map with String to return an array with the numbers in the sphValues array converted to strings.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *