要访问JavaScript中的对象数组的方法,可以尝试运行以下代码,其中的方法被访问:
<html> <head> <title>JavaScript Array join Method</title> </head> <body> <script> var arr = new Array("First","Second","Third"); var str = arr.join(); document.write("str : " + str ); var str = arr.join(", "); document.write("<br />str : " + str ); </script> </body> </html>
输出结果
str : First,Second,Third str : First, Second, Third