Front End Web Developer Question: Download Front End Web Developer PDF
Tell me difference between null and undefined?
Answer:
This can be tricky and the best way to keep in your head is to memorise because if you try to relate javascript null to other languages, it will get more confusing.
In javascript, null is an object with no value and undefined is a type.
typeof null; // "object"
typeof undefined; // "undefined"
var a;
var b = null;
a == b; // "true" because their values are the same
a === b; // "false". they have different types
In javascript, null is an object with no value and undefined is a type.
typeof null; // "object"
typeof undefined; // "undefined"
var a;
var b = null;
a == b; // "true" because their values are the same
a === b; // "false". they have different types
Previous Question | Next Question |
Explain me why Do We Recommend External Css Or Javascript Versus Inline? | Tell me what is a RESTful Web Service? |