Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Array.prototype.multiply = function(){
- const le = this.length;
- for(let i=0; i < le; i++){
- this[i+le] = this[i]*this[i];
- console.log(this)
- }
- };
- const a = [1, 2, 3, 4, 5];
- a.multiply();
- console.log(a); //[1, 2, 3, 4, 5, 1, 4, 9, 16, 25]
Add Comment
Please, Sign In to add comment