Is it possible to add a method to an array() in javascript? (I know about prototypes, but I don\'t want to add a method to every array, just one in particular).
The
Yep, easy to do:
array = []; array.foo = function(){console.log("in foo")} array.foo(); //logs in foo