顺序 a、b、c、d、e、f、g、h、i、j、k、l、m、n、o、p、q、r、s、t、u、v、w、x、y、z
一、数组方法
join()
join()
方法也可将所有数组元素结合为一个字符串。它的行为类似 toString(),但是您还可以规定分隔符。
var fruits = ["Banana", "Orange","Apple", "Mango"]; var fruits2 = fruits.join(" * "); console.log(fruits2); //结果:Banana * Orange * Apple * Mango
pop()
pop()
方法从数组中删除最后一个元素。
var fruits = ["Banana", "Orange","Apple", "Mango"]; var fruits2 = fruits.pop(); console.log(fruits); //结果:"Mango" console.log(fruits2); //结果:["Banana", "Orange", "Apple"]
push()
push()
方法(在数组结尾处)向数组添加一个新的元素。
var fruits = ["Banana", "Orange", "Apple", "Mango"]; var fruits2 = fruits.push("Kiwi"); console.log(fruits); //结果:["Banana", "Orange", "Apple", "Mango", "Kiwi"] console.log(fruits2); //结果:5
toString()
toString()
方法把数组转换为数组值(逗号分隔)的字符串。
var fruits = ["Banana", "Orange", "Apple", "Mango"]; var fruits2 = fruits.toString(); console.log(fruits2); //结果:Banana,Orange,Apple,Mango
标签:顺序,fruits2,汇总,JS,var,Mango,fruits,Orange,Banana From: https://www.cnblogs.com/miangao/p/16853817.html