js registering array method
// this is a safer way to assign method to the Array object then
// Array.prototype.methodName = function().
// With this way, when you iterate the array, your method won't be considered as one of the
// array values
Object.defineProperty( Array.prototype, 'methodName', {
value: function( value1, value2 ... ) {
// define method here
// use "this" to access array
},
enumerable: false
});
// to use the method on an array
[1,2,3].methodName( value1, value2 ... );