I was trying to make a method inside an array object to delete an element from my array object. Here is the code:
a.__proto__.remove = index => { this.splice(index,1) };
But I am getting an unexpected error when I am trying to execute this method like below:
TypeError: this.splice is not a function
But why? Please help me to get out of this error. Here is my full code:
a = [1,2,3,4,5];
a.__proto__.remove = index => { this.splice(index,1) };
a.remove(3);
Thanks a ton.