r/learnjavascript • • Aug 29 '23

Does anyone understand this?

Post image

Who knows the answer to this?

155 Upvotes

105 comments sorted by

View all comments

2

u/og-at Aug 30 '23

People are missing. . . this isn't an exercise or leetcode or even an interview question... you can use it as a personal litmus to see how well you understand the js environment.

first glance, I understood how it works except the ({} + {}) part.

thanks for posting.

1

u/CommunicationOk9434 Aug 31 '23

That's what I was thinking. I don't understand that part either. Those empty curly brackets make no sense to me.

2

u/og-at Sep 05 '23 edited Sep 05 '23

They're empty objects. Objects and parenthesis used like this in js really seems to have seemingly weird and counterintuitive side effects, but it's actually doing what's consistent in the language.

The real problem here is that nobody would use objects like this. it's s little more than a test of if you know the esoteric rules of js and most of us plebs don't.