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

7.8.9 toString() and toLocaleString()

7.8.9 toString() and toLocaleString()

An array, like any JavaScript object, has a toString()method. For an array, this method converts each of its elements to a string (calling the toString()methods of its elements, if necessary) and outputs a comma-separated list of those strings. Note that the output does not include square brackets or any other sort of delimiter around the array value. For example:

[1,2,3].toString() // Yields '1,2,3' ["a", "b", "c"].toString() // Yields 'a,b,c' [1, [2,'c']].toString() // Yields '1,2,c'

Note that the join() method returns the same string when it is invoked with no arguments.

toLocaleString() is the localized version of toString(). It converts each array element to a string by calling the toLocaleString() method of the element, and then it concatenates the resulting strings using a locale-specific (and implementation-defined) separator string.

友情链接It题库(| 版权归yishouce.com所有| 友链等可联系|粤ICP备16001685号-1