1. 程式人生 > >js 基礎語法demo

js 基礎語法demo

archive demo ida rst reac ron eee tro key

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); }); }

js 基礎語法demo