const droid = {
name: 'R2-D2',
height: '1.08',
colors: ['blue', 'silver']
}
const newDroid = droid
delete newDroid.colors
//the original object is updated by deleting colors attribute
console.log(droid)
// [object Object] {
// height: '1.08',
// name: 'R2-D2'
// }
// newDroid was updated by reference
console.log(newDroid)
// [object Object] {
// height: '1.08',
// name: 'R2-D2'
// }
Created
March 20, 2021 13:31
-
-
Save darleykrefta/14d98f0373c3123d3103d3f4039a0c13 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