$defined has to do with undefined variables.
Comparing a variable with null, instead of using typeof, make the browser to return a "VAR is not defined" error.
direct comparison with null returns the error: "VAR is not defined"
This solves nothing. You get the error when you try to pass an undefined variable, not when it is compared to null.
$defined is there to check if the value of a defined variable is undefined or null.
sorry... so what's the right way to verify if a variable is undefined?
i have to use 'type of' directly in my code?
yes, though I personally like to check this.varName. But that's just me.
yeah you do. You cant pass an undefined variable to any non-native-function. That's why $defined is not in 1.3.
fabiomcosta: you cant pass an undefined variable anywhere, native or no native.
ok thank you both
kamicane: typeof is native and accept undefined vars ;-p
@kamicane yeah i thought some other native functions would accept too, but yeah looks like typeof is the ONLY function that accepts an undefined value.
You're not passing it anywhere. It's not a function call.
typeof(a), function right?
typeof is a special operator that can also be used with a function notation. It is not a function.