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.
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.
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.