Skip to content

Instantly share code, notes, and snippets.

@Drag13
Created September 20, 2018 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Drag13/924b6434273ea770f83871125bce1777 to your computer and use it in GitHub Desktop.
Save Drag13/924b6434273ea770f83871125bce1777 to your computer and use it in GitHub Desktop.
const originalPush = Array.prototype.push;
Array.prototype.push = function newPush() {
console.log('before push');
originalPush.call(this, arguments[0]);
console.log('after push');
}
let x = [];
x.push('a');
console.log(x[0]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment