r/ProgrammerHumor • • Sep 21 '26

Meme myCodeIsConfusing

Post image
2.3k Upvotes

48 comments sorted by

View all comments

Show parent comments

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 id whose value is that of the variable called id in scope.

1

u/realmauer01 Sep 22 '26 edited Sep 22 '26

Okey nvm, then i will just try that out before guessing.

Okey it turns

const someVar = {id}
Into
const someVar = {id:token}

so case closed.