Skip to content Skip to sidebar Skip to footer

Trying To `call` Three Methods But Not Working Correctly With Jquery Map

Update #1 I forgot to pass the current object as the first paremeter; see K's answer I have the following methods that are on a google maps. The methods work fine like this: arc.p

Solution 1:

You're passing the wrong context to the call function. Actually, you miss it. Try this:

var selected_methods=[arc.pLocations,arc.pLikedLocations,arc.pLikedItems];

$.map(selected_methods, function(val, i){
    console.log("here is index:" + i);
    val.call(arc,ne,sw,m); //Notice the arc
});

Post a Comment for "Trying To `call` Three Methods But Not Working Correctly With Jquery Map"