Node.js examples for Object:Object Operation
Test that a warning will occur when modifying a native object's prototype.
Array.prototype.count = function (value) { var count = 0, i; for (i = 0; i < this.length; ++i) { if (this[i] === value) { ++count;/*from w w w .ja v a 2 s .com*/ } } return count; }; Boolean.prototype = { sup: function () {} }; NonArray.prototype.random = function () { return 4; };