1.2.5.6.危險小叮嚀:陣列與 for in
陣列是物件, 而成員是被新增的屬性
var arr = ['John', 'Jane', 'Jim']
for (var prop in arr) {
console.log(prop + ':' + arr[prop])
}
Array.prototype.myCustomFeature = 'cool!'
Last updated
Was this helpful?
陣列是物件, 而成員是被新增的屬性
var arr = ['John', 'Jane', 'Jim']
for (var prop in arr) {
console.log(prop + ':' + arr[prop])
}
Array.prototype.myCustomFeature = 'cool!'
Last updated
Was this helpful?