Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert a Char Array to a String

Tags:

javascript

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? 
like image 290
moey Avatar asked Sep 15 '11 02:09

moey


People also ask

How do I convert an array of numbers to strings?

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.


1 Answers

Use join:

string = s.join(""); 
like image 95
Digital Plane Avatar answered Oct 05 '22 07:10

Digital Plane