for语句
var arr = [1,2,4,6]
for(var i = 0, len = arr.length; i < len; i++){
console.log(arr[i])
}
foreach语句
var arr = [1,5,8,9]
arr.forEach(function(item) {
console.log(item);
})
for-in语句
var obj = {
name: 'test',
color: 'red',
day: 'sunday',
number: 5
}
for (var key in obj) {
console.log(obj[key])
}
for-of语句
var arr = [{name:'bb'},5,'test']
for (item of arr) {
console.log(item)
}