typeof, Undefined, Null in Javascript
typeof, Undefined, Null in Javascript
In this article we are goanna to see about typeof, Undefined, Null in Javascript and where we use these. which is most important when you are going to start your career in JavaScript. Please ready and enjoy this article if you want to give any feedback about your experience, we welcome.
Typeof operator
The typeof operator returns a string indicating the type of the unevaluated operand.
The operand can be either a literal or a data structure such as a variable, a function, or an Object.
Syantx:
typeof(123);
typeof(“Hello world”);
Undefined:
The undefined property indicates that a variable has not been assigned a value, or not declared at all.
Ex: var a;
document.write(a);
document.write(typeof(b));
Null:
In JavaScript null is "nothing". It is supposed to be something that doesn't exist.
Ex: var a = null;
document.write(a);
document.write(typeof(a));
0 comments
Please leave your comments...... Thanks