Created
September 6, 2019 19:30
-
-
Save vidhill/9c6337741028bdae387e4890a655a253 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 doFoo = (passedObj) => { | |
passedObj.foo = true; | |
passedObj.bar = false; | |
return { | |
cat: 'meow', | |
passedObj | |
}; | |
} | |
const objectA = {}; | |
const result = doFoo(objectA); | |
console.log(result.passedObj === objectA) // equals true | |
// and even worse! | |
console.log(objectA) // logs { "foo": true, "bar": false } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment