Advertisement
VoidRayChe

Try to implement pop 2

Feb 14th, 2020
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.20 KB | None | 0 0
  1. function implementPop(arr){
  2. Array.prototype.ipop = function(){
  3. let popedEl = this[this.length-1];
  4. this.length = 5;
  5. return popedEl;
  6. }
  7.  
  8. console.log(arr.ipop());
  9. console.log(arr);
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement