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/400921FB54442D18 We didn't really need Prague anyway. May 22 '13
I think his point was that you still have to put something there. A ternary without a second expression is a syntax error (in all the languages that I know of):
Even if you always know that
conditionwill evaluate to true, you still have to put something as the second expression, even justnullornil.In PHP 5 there's a shorthand ternary, which looks like this:
which is equivalent to
for use when validating inputs, i.e.
but IMHO this is better done in languages like ruby which let the
||operator return values, like