js基礎――配列(Aray)の遍歴、for();forEach()

568 ワード




var arr = [1,3,5,7,9];

for(var i = 0; i < arr.length; i++){
    
    console.log(arr[i]);

}


forEach()
        ie8+  
              (    )
                      ,
                              ,
                 ,

                    
              :         
              :           (index)
              :         
    
    arr.forEach(function(value,index,Arr){
          console.log("value::::::"+value);
          console.log("index::::::"+index);
          console.log("Arr::::::"+Arr);
    });