Created
December 12, 2021 08:08
-
-
Save amrelarabi/fe64d89d026983f804836fdd65d85731 to your computer and use it in GitHub Desktop.
This file contains 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
let oldArray = [1, 2, 3]; | |
let newArray = [...oldArray, 4, 5]; | |
// [ 1, 2, 3 ] | |
console.log(oldArray); | |
[ 1, 2, 3, 4, 5 ] | |
console.log(newArray); | |
oldArray.pop(); | |
[ 1, 2 ] | |
console.log(oldArray); | |
[ 1, 2, 3, 4, 5 ] | |
console.log(newArray); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment