Created
October 13, 2017 00:23
-
-
Save eloytoro/14773a2fecdaa537c62ce97e0af50cc4 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
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