javascript convert array object to string code example

Example 1: js array to string

var myArray = ['no','u'];
var myString = myArray.toString();

Example 2: convert array object to string javascript

var ar = ['a', 'b', 'c', 'd', 'e', 'f', 'g']; 
console.log( ar.join('') ); // abcdefg
console.log( ar.join(' : ') ); // a : b : c : d : e : f : g
console.log( ar.join('-') ); // a-b-c-d-e-f-g
console.log( ar.join('|') ); // a|b|c|d|e|f|g

Example 3: array to string javascript

<array>.join(<splitting character(s)>);

Tags:

Java Example