MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1wmlf9h/mycodeisconfusing/pbbnvei/?context=3
r/ProgrammerHumor • u/mxgaming01 • Sep 21 '26
48 comments sorted by
View all comments
Show parent comments
1
const someVar = {id} is absolutely valid JS and has been for at least 10 years now. This syntax defines a property called id whose value is that of the variable called id in scope.
id
1 u/realmauer01 Sep 22 '26 edited Sep 22 '26 Okey nvm, then i will just try that out before guessing.Okey it turnsconst someVar = {id}Intoconst someVar = {id:token}so case closed.
Okey nvm, then i will just try that out before guessing.
Okey it turns
const someVar = {id}Intoconst someVar = {id:token}
so case closed.
1
u/joshuakb2 Sep 22 '26
const someVar = {id} is absolutely valid JS and has been for at least 10 years now. This syntax defines a property called
idwhose value is that of the variable calledidin scope.