I have a Prototype class which has a function removeMarker.
var Location = Class.create({
removeMarker: function(){
// Some code here to remove a marker from a map
}
});
I have an array of these:
var locations = [];
Is there an easy way to invoke removeMarker() on every location object in the array?
At the moment I am using:
locations.each(function(l,i) {
l.removeMarker();
});
I am sure I have seen something using .map() or .invoke() but running
locations.invoke(removeMarker);
doesn't seem to work. I know I am just doing something stupid, just need someone to point it out...
eachandinvokeare definitely not native JavaScript methods. I don't understand what your question has to do with prototypes and enumerable properties.