'use strict';
var strArray = ['a','b','c','d'];
console.log('循环数组:for');
for(var i = 0;i<strArray.length;i++){
console.log('i='+i+';'+'strArray[i]='+strArray[i]);
}
console.log('循环数组:for in');
for(var i in strArray){
console.log('i='+i+';'+'strArray[i]='+strArray[i]);
}
var obj = {'a':'A','b':'B','c':'C','1':'1re'};
console.log('循环对象:for');
console.log('obj.length:'+obj.length);
for(var i = 0;i<obj.length;i++){
console.log('i='+i+';'+'obj[i]='+obj[i]);
}
console.log('循环对象:for in');
for(var i in obj){
console.log('i='+i+';'+'obj[i]='+obj[i]);
}
console.log('测试对象:obj[1]='+obj[1]);
console.log('测试对象:obj[1]='+obj[2]);
console.log('测试对象:obj[a]='+obj['a']);