Guest User

Untitled

a guest
Nov 14th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. Array.prototype.multiply = function(){
  2. const le = this.length;
  3. for(let i=0; i < le; i++){
  4. this[i+le] = this[i]*this[i];
  5. console.log(this)
  6. }
  7. };
  8.  
  9. const a = [1, 2, 3, 4, 5];
  10. a.multiply();
  11. console.log(a); //[1, 2, 3, 4, 5, 1, 4, 9, 16, 25]
Add Comment
Please, Sign In to add comment