jQuery中map方法

jQuery的map方法可以遍历数组,也可以遍历伪数组

$(function(){
            var arr=[1,2,34,]
            var fakeArray = {
            length: 3,
            "0": "first",
            "1": "second",
            "2": "third"
            };
 
            $.map(arr,function(value,index){    //arr要遍历的数组,value遍历的值,index遍历的索引
                console.log(index,value)
                }
            )
            $.map(fakeArray,function(value,index){
                console.log(index,value)
                }
            )
        })