How can you add a function to all objects in a JavaScript array?

I am using Angular, but basically my controller has an array of objects that are returned from an AJAX query via HTTP, and I want to decorate each object in the array with a function to prettify a boolean property on the object so it renders as Yes/No instead of true/false. I don't mind using jQuery or Angular, if there's a way to do this with either of them.

You can use each:

$.each(myArray, function(index, item) {
    //do stuff
});

You can do something like this:

function prettify(prop){
     if(prop) return "Yes" 
     else return "No"
}

$.each(arr, function(index, item) {
    item.myFunction = prettify;
});

If you actually want to add a method to each object instance, you can simply expando them:

$.each(theArray, function(i, obj) {
    obj.prettyBool = function() {
        return obj.theProperty ? 'Yes' : 'No';
    };
});

loop through your array and for each item in the array assign an event listener to it with a handler function.

$.each(myArray, function(index, item) {
    item.on('event', eventHandlerFunction);
});