Make property non-enumerable. - Node.js Object

Node.js examples for Object:Property

Description

Make property non-enumerable.

Demo Code


Object.defineProperty(Array.prototype, 'pull', {
  enumerable:false,//w  w w  .ja  v a2  s. co m
  writable:true,
  configurable:true
});

/**
 * Removes the passed item from an array, the opposite of push().
 * @param item
 * @return {*}
 */
Array.prototype.pull = function (item) {
  var index = this.indexOf(item);
  if (index > -1) {
    this.splice(index, 1);
    return index;
  } else {
    return -1;
  }
};

Related Tutorials