Skip to content Skip to sidebar Skip to footer

Calling Original Method When Overriding Array Push

I'm attempting to override push on an array. I need to be able to call the original push method before overriding so I can push the element onto the array. Below is my code. I've a

Solution 1:

Invoke the original prototype implementation with your current object as context:

Array.prototype.push.call(this, el)

Post a Comment for "Calling Original Method When Overriding Array Push"