Skip to content

Instantly share code, notes, and snippets.

@eloytoro
Created October 13, 2017 00:23
Show Gist options
  • Save eloytoro/14773a2fecdaa537c62ce97e0af50cc4 to your computer and use it in GitHub Desktop.
Save eloytoro/14773a2fecdaa537c62ce97e0af50cc4 to your computer and use it in GitHub Desktop.
const val = {}
function setProp(obj, value) {
obj.prop = value
return obj
}
console.log(val, mutate(val, 'one'))
const obj1 = { val }
const obj2 = { val }
console.log(obj1, obj2, mutate(obj1.val, 'two'))
const ref = obj1.val
console.log(ref, obj1, obj2, mutate(ref, 'three'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment