标签:jquery java reac value 元素 func 遍历 方法 需要
var arr1 = [1,2,3,4];
for(currentValue in arr1)
{
    document.write( currentValue + ‘<br>‘ );
}var arr2 = [1,2,3,4];
arr2.forEach(function(currentValue,index,arr)
{
    // currentValue 必需。当前元素。
    // index 可选。当前元素的索引值。
    // arr 可选。当前元素所属的数组对象。
    // document.write( ‘arr2[‘ + index + ‘]=‘ + currentValue + ‘<br>‘ );
    document.write( ‘arr2[‘ + index + ‘]=‘ + arr[index] + ‘<br>‘ );
})var arr3 = [1,2,3,4];
$.each(arr3,function(index,value){
    // index 必需。当前元素的索引值。
    // value 必需。当前元素。
    // document.write( ‘arr3[‘ + index + ‘]=‘ + value + ‘<br>‘ );
    document.write( ‘arr3[‘ + index + ‘]=‘ + arr3[index] + ‘<br>‘ );
})标签:jquery java reac value 元素 func 遍历 方法 需要
原文地址:https://www.cnblogs.com/Ra1nb0w/p/9791540.html