Last active
May 3, 2023 17:06
-
-
Save ology/da8ba9e2e10ed8fc91c5013717c005a2 to your computer and use it in GitHub Desktop.
Assigning to an undefined key in node? Crazy!
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 foo = { x: 123, y: 667 }; | |
console.log(foo['z']); | |
foo[foo['z']] = 'HELLO?'; | |
console.log(foo); | |
/** | |
* output: | |
* undefined | |
* { x: 123, y: 667, undefined: 'HELLO?' } | |
**/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment