Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const array = ['😉','😊','😇']
- const copyWithEquals = array // Changes to array will change copyWithEquals
- const copyWithSpread = [...array] // Changes to array will not change copyWithSpread
- array[0] = '😡' // Whoops, a bug
- console.log(...array) // 😡 😊 😇
- console.log(...copyWithEquals) // 😡 😊 😇
- console.log(...copyWithSpread) // 😉 😊 😇
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement