How do you convert an array of characters to a string in JavaScript?
var s = ['H', 'e', 'l', 'l', 'o']; // How to convert s to a string?
To convert an array of numbers to an array of strings, call the map() method on the array, and on each iteration, convert the number to a string. The map method will return a new array containing only strings.
Use join
:
string = s.join("");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With