<h1>陣列方法的應用</h1> <pre> 預設的兩個陣列內容 var myarray1 = [ "one", "two", "three" ]; var myarray2 = [ "four", "five", "six" ]; </pre> <ul> <li>res = myarray1.join('| ') 輸出的結果: res: "<strong name="myoutput"></strong>"</li> <li>myarray3 = myarray1.concat(myarray2) 輸出的結果: myarray3: "<strong name="myoutput"></strong>"</li> <li>res = myarray1.pop() 輸出的結果: myarray1: "<strong name="myoutput"></strong>"</li> <li>res = myarray1.push("seven") 輸出的結果: myarray1: "<strong name="myoutput"></strong>"</li> <li>res = myarray1.shift() 輸出的結果: myarray1: "<strong name="myoutput"></strong>"</li> <li>myarray4 = myarray3.slice(1,4) 輸出的結果: myarray4: "<strong name="myoutput"></strong>"</li> <li>myarray3.sort() 輸出的結果: myarray3: "<strong name="myoutput"></strong>"</li> <li>myarray3.reverse() 輸出的結果: myarray3: "<strong name="myoutput"></strong>"</li> <li>res = myarray4.toString() 輸出的結果: res: "<strong name="myoutput"></strong>"</li> </ul>