Created
December 9, 2020 20:56
-
-
Save DoctorDerek/a9b8d36bb623d6b7712521eeb85a16e6 to your computer and use it in GitHub Desktop.
Method 2 - The ... Spread Operator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Joining Two Arrays with ... Spread | |
| const array1 = ["🎅", "🤶"] | |
| const array2 = ["👩🚀", "👨🚀"] | |
| // Use ... spread to join the arrays: | |
| console.log([...array1, ...array2]) | |
| // Spread won't change either array: | |
| console.log(array1) | |
| console.log(array2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment