DEV Community

Discussion on: Javascript's Persistent Popularity: No one seems to particularly enjoy the language, but everyone is using it

Collapse
 
lluismf profile image
Lluís Josep Martínez • Edited

A short example of why I hate JS so much.
Recently I concatenated two strings in Java with the || operator (I write SQL often and got confused) and I got a compiler error immediately.

The same in JS, even at runtime it doesn't throw an error, it simply converts the second string to an empty string. WTF??????

Try it: alert("Hello" || " World")

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
lluismf profile image
Lluís Josep Martínez

As I said "I write SQL often and got confused" and JS instead of complaining simply does "something". Event if it doesn't make any sense like in this case.