Last active
February 21, 2022 22:49
-
-
Save blarfoon/50d2d68197a18c896c2f74ff250fd6af 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 myObject = { | |
hi: "mom", | |
someone: { | |
else: "red", | |
}, | |
}; | |
function doSomething(whatever) { | |
whatever.hi = "medium"; | |
whatever.someone.else = "blue"; | |
}; | |
console.log(myObject); // > {"hi":"mom","someone":{"else":"red"}} | |
doSomething({ ...myObject }); | |
console.log(myObject); // > {"hi":"mom","someone":{"else":"blue"}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment