Archive for May 9, 2007

JavaScript join Method: Create String From Array

Posted in JavaScript, Software, Web, internet, programming on May 9, 2007 by Joey

The join method can be used in JavaScript to create a string from an array.

var aryTest = [7,5,8,19,6];
var strTest = aryTest.join();
document.write(strTest);

The preceding example takes a JavaScript array and applies the join method on it to create a string. The join method takes one optional parameter: The delimiter that separates the values. The default is a comma.

Related Articles:
JavaScript split Method – Create Array From String