订阅汇聚素材网Feed

字符串slice,substr,substring,charAt 数组splice,slice,pop,push,shift,unshift

‘Apple,Banana,Kiwi’.slice(6)=Banana,Kiwi


‘Apple,Banana,Kiwi’.substr(6)=Banana,Kiwi


‘Apple,Banana,Kiwi’.substring(6)=Banana,Kiwi


‘Apple,Banana,Kiwi’.substr(6,6)=Banana


‘Apple,Banana,Kiwi’.substring(6,12)=Banana


‘Apple,Banana,Kiwi’.charAt(1)=p


[“Banana”, “Orange”, “Lemon”, “Apple”, “Mango”].slice(1,3)=Orange,Lemon
slice后不改变原数组=Banana,Orange,Lemon,Apple,Mango


[“Banana”, “Orange”, “Lemon”, “Apple”, “Mango”].splice(1,2)=Orange,Lemon
splice后改变原数组=Banana,Apple,Mango


arr=[“Banana”, “Orange”, “Lemon”, “Apple”, “Mango”]; arr.splice(0,0,”这是新加的”); arr=这是新加的,Banana,Orange,Lemon,Apple,Mango


arr=[“Banana”, “Orange”, “Lemon”, “Apple”, “Mango”]; arr.unshift(‘新加的’);arr=新加的,Banana,Orange,Lemon,Apple,Mango


arr=[“Banana”, “Orange”, “Lemon”, “Apple”, “Mango”]; arr[arr.length]=’新加的';arr=Banana,Orange,Lemon,Apple,Mango,新加的


arr=[“Banana”, “Orange”, “Lemon”, “Apple”, “Mango”]; arr.push(‘新加的’);arr=Banana,Orange,Lemon,Apple,Mango,新加的


arr=[“Banana”, “Orange”, “Lemon”, “Apple”, “Mango”]; arr.pop();arr=Banana,Orange,Lemon,Apple


arr=[“Banana”, “Orange”, “Lemon”, “Apple”, “Mango”]; arr.shift();arr=Orange,Lemon,Apple,Mango

16 人Likes
  

文章转载请注明:字符串slice,substr,substring,charAt 数组splice,slice,pop,push,shift,unshift-汇聚素材网

本文固定链接:http://www.webhj.com/hj-2450.html  +复制链接

字符串slice,substr,substring,charAt 数组splice,slice,pop,push,shift,unshift:等您坐沙发呢!

发表评论

*

*

4 + 0

快捷键:Ctrl+Enter
0全站搜索 1 设计 2 素材 3 教材 4 WEB 5 电子书籍