Skip to content

Instantly share code, notes, and snippets.

@yaakov123
Last active November 6, 2020 11:57
Show Gist options
  • Save yaakov123/0e2a309dad8b4dad8a5795326e0ba091 to your computer and use it in GitHub Desktop.
Save yaakov123/0e2a309dad8b4dad8a5795326e0ba091 to your computer and use it in GitHub Desktop.
const items = ['apple', 'orange', 'banana'];
Array.prototype.push = function(item) {
console.log(`Array push intercepted. Pushing ${item} into [${this}]`);
}
items.push('grape'); // Will log the above statement to the console
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment