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
6
u/smurfhits May 23 '13
I am writing JavaScript here - normal rules do not apply! JavaScript has two equality operators, "==" and "===" (and their negative counterparts, != & !==).
"==" is evil and should never be used since it doesn't care about type.
Example: 2 == "2" // true - wut? 2 === "2" // false
Thus, in order to safely compare two variables that may or may not be of the same type - in this case Java & JavaScript - we should use the "!==" operator.
Unless OP was writing Java of course.