Skip to content

Instantly share code, notes, and snippets.

@postman31
Created October 17, 2018 09:51
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 postman31/e84dcc621cd08bb6f977c2fd52386649 to your computer and use it in GitHub Desktop.
Save postman31/e84dcc621cd08bb6f977c2fd52386649 to your computer and use it in GitHub Desktop.
training push override
var someArray = []
someArray.push = function (element){
//Do what you want here...
if (element) {
console.log (element)
}
return Array.prototype.push.apply(this,arguments);
}
document.addEventListener('submit', function(e) {
someArray.push(e.target.id || 'unknown form')
console.log('submitted')
e.preventDefault()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment