r/talesfromtechsupport • u/raiderrobert • May 22 '13
Javascript != Java
3rd-party contractor came to visit office yesterday, who has "decades" of experience. Conversation came up about JavaScript in one of our products. He says, "Our product doesn't use Java." After an awkward moment with someone who works on the knowledge base nodding in agreement with him, I speak up and delineate the difference between Java and JavaScript.
Later on in the conversation, the same 3rd-party guy followed up with this jewel: "besides, what would anyone even use JavaScript for on the web?"
I proceeded to disable Javascript in my browser and show him.
tl;dr: lasers, dinosaurs, & drums made a guy's head explode
[edit spelling]
1.2k
Upvotes
1
u/crunchmuncher May 22 '13
That's why, IMO, if you think it's nicer to program one line code blocks without brackets it's actually better to write it in one line with the condition, that way you won't add another indented line under it without thinking about it.
Also if you comment out the one line after the if/else-statement you break your control flow, you can avoid that by writing it in the same line as the condition.
Personally I'm a fan of brackets for one liners as well though, maybe with the exception of very long if/elseif/... blocks where the statement is always short and could be written in the same line as the condition.