const darkSide = ['Darth Vader', 'Darth Sidious', 'Supreme Leader Snoke']
// define newDarkSide with darkSide reference
const newDarkSide = darkSide
// remove the last element of the new array created
newDarkSide.pop()
// the original variable is updated too, because it is the original reference
console.log(darkSide)
// ['Darth Vader', 'Darth Sidious']
// variable newDarkSide was updated by the reference
console.log(newDarkSide)
// ['Darth Vader', 'Darth Sidious']
Created
March 20, 2021 13:13
-
-
Save darleykrefta/2b8a09ebb282c044892e615b05cacde1 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment