Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***************************************
- Array.from()
- -create a new shallow copy array
- ***************************************/
- let names = ['Bart','Maggie','Homer','Marge','Lisa'];
- let stuff = [123, 'Apu',
- {Smithers: 'Mr. Burns'},
- ['Futurama', 'Disenchantment']];
- let nm2 = Array.from(names);
- let st2 = Array.from(stuff);
- nm2[4] = 'Flanders';
- st2[2].Smithers = 'Not Mr. Burns';
- console.log( stuff);
- console.log( st2);
- console.log( names );
- console.log( nm2 );
Add Comment
Please, Sign In to add comment