Node.js examples for Array:Add Element
Add new method contains to Array
/**/*from w w w . ja va 2 s. c o m*/ * Array.prototype.[method name] allows you to define/overwrite an objects method * returns true if element is in the array, and false otherwise */ Array.prototype.contains = function ( element ) { for (i in this) { if (this[i] === element) return true; } return false; }