Skip to content

Instantly share code, notes, and snippets.

@nataliemarleny
Created December 10, 2018 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nataliemarleny/4c23faccc7f2f2eb823a4b64c47fe819 to your computer and use it in GitHub Desktop.
Save nataliemarleny/4c23faccc7f2f2eb823a4b64c47fe819 to your computer and use it in GitHub Desktop.
Object Assignment and Copying Proof in Javascript
> o1 = { b: 'c' }
{ b: 'c' }
> o2 = o1
{ b: 'c' }
> o3 = { ...o1 }
{ b: 'c' }
> o1 === o2
true
> o1 === o3
false
> { o1, o2, o3 }
{ o1: { b: 'c' }, o2: { b: 'c' }, o3: { b: 'c' } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment