千鋒web前端開(kāi)發(fā)項(xiàng)目教程_1000集完全零基礎(chǔ)入門(mén)HTML5+CSS3+JS到

p204 數(shù)組的寫(xiě)法
數(shù)組:有序的 數(shù)據(jù) 的集合
var arr=[100,true,'hello world']
索引0位置是100
索引1位置是true
索引2位置是"hello world"
索引從0開(kāi)始 依次+1
獲取數(shù)組的長(zhǎng)度 arr.length
要設(shè)置就讓arr.length=數(shù)字
獲取數(shù)據(jù) arr[2]
修改數(shù)據(jù) arr[2]=200;
數(shù)組的遍歷
for(var i=0;i<arr.length;i++){
console.log(arr[i])
}
標(biāo)簽: