OK jQuery experts : So .. I'm coming from a Prototype background.
I do the following code all the time (or some similar variation):
MyObject.prototype.someFunction = function()
{
var myArray = ["a","b","c"];
myArray.each(function(arrayEntry)
{
this.printPart(arrayEntry);
}, this);
}
MyObject.prototype.printPart = function(part)
{
console.log(part);
}
I'm looking through the jQuery docs -- I don't see how to do this.
Is this possible?
In particular, I'm interested in:
- Iterating through javascript arrays (objects would be nice too).
- Maintaining scope. Notice the final "this" parameter to the each function.