js 基础语法demo
for-forEach
/** * for/foreach * http://www.cnblogs.com/Fskjb/archive/2011/03/26/1996165.html * http://www.cnblogs.com/fangshidaima/p/5910604.html */ function testForeachStatement() { debugger; var arrStr = ["AAA", "BBB", "CCC", "DDD", "EEE"]; for(var key in arrStr) { console.log(key); // key(index) } arrStr.forEach(function(value, index, array) { console.log(value); console.log(index); console.log(array); }); }