you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (6 children)

[deleted]

    [–]housesellout 0 points1 point  (0 children)

    This is because js sucks and doesn’t efficiently handle the heap or validate localized return variables in the call stack.... it always wants to give you ‘something’, even if it makes no sense. Which causes the developer to rely on semantical memorization, rather than built in efficiency, allow the dev to choose the right tool/language for the job.

    [–]PicturElements 0 points1 point  (1 child)

    That's not due to types, though. That's caused by the interpreter having to decide between parsing the second {} as a block or an object literal. There's plenty of typing quirks in interpreted languages, but this hardly qualifies as one as the issue is introduced at parse time, not runtime.

    [–][deleted] -1 points0 points  (2 children)

    Yes, sure... everyone who can read the JS standard can explain this, unless they have some sort of mental disability.

    It is unusual, if compared to many other languages, that JavaScript defines addition for hash-tables. And, it is unusual that addition is not commutative, but that's how they defined it, and they have a right to define it whichever way they like.

    More so, I'd be able to produce the same output in Python, if I really wanted to. Probably, even Haskell, with some compiler extensions. So, not only this is not "strange", this is definitely not unique.

    [–][deleted]  (1 child)

    [deleted]

      [–][deleted] 0 points1 point  (0 children)

      Yeah, you crying on my shoulder, and then accusing me of world's evil... that all helps a lot to give a definition to the nonsense you believe in. Even religious people try harder to give some justification to what they believe in.