Created
January 8, 2019 02:10
-
-
Save Tombarr/85cf17bcafc229aece52e8fc6f372ed1 to your computer and use it in GitHub Desktop.
Don't reassign your function arguments
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 hey = (person) => { | |
person.name = person.name || "Tom"; | |
console.log(`Hey, ${person.name}`); | |
}; | |
let bob = {}; | |
hey(bob); // "Hey, Tom" | |
bob // { name: "Tom" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment