mrvaskokurko mrvaskokurko - 6 months ago 36
Javascript Question

What does != mean in JavaScript?

I am mainly trying to figure out what this function is trying to say. For the most part I understand that the function is checking the variables and seeing if they are indeed variables. But what does != say in the script?

function fun2() {
var output = "";

if (typeof myGlobal != "undefined") {
output += "myGlobal: " + myGlobal;

if (typeof oopsGlobal != "undefined") {
output += " oopsGlobal: " + oopsGlobal;



The operator != means if is different for example red != blue it return true, you can check the documentation of expressions and operators here: Comparison_operators Dev Mozilla JS