JavaScript: The Definitive Guide, Sixth Editio javaScript权威指南(第6版) pdf 文字版-文字版, javascript电子书, 和javascript 有关的电子书:

7.8.1 join()

7.8.1 join()


The Array.join() method converts all the elements of an array to strings and concatenates them, returning the resulting string. You can specify an optional string that separates the elements in the resulting string. If no separator string is specified, a comma is used. For example, the following lines of code produce the string “1,2,3”:

var a = [1, 2, 3]; // Create a new array with these three elements a.join(); // => "1,2,3" a.join(" "); // => "1 2 3" a.join(""); // => "123" var b = new Array(10); // An array of length 10 with no elements b.join('-') // => '---------': a string of 9 hyphens

The Array.join() method is the inverse of the String.split() method, which creates an array by breaking a string into pieces.

欢迎转载,转载请注明来自一手册:http://yishouce.com/book/1/31348.html
友情链接It题库(ittiku.com)| 版权归yishouce.com所有| 友链等可联系 admin#yishouce.com|粤ICP备16001685号-1