1.

What is undefined in TypeScript?

Answer»

When a VARIABLE is declared without initialization, it’s assigned the undefined value. It’s not very useful on its own. A variable is undefined if it’s declared, but no value has been assigned to it. In contrast, null is assigned to a variable, and it represents no value. 

console.log(null == null); // trueconsole.log(undefined == undefined); // trueconsole.log(null == undefined); // true, with type-conversionconsole.log(null === undefined); // FALSE, without type-conversionconsole.log(0 == undefined); // falseconsole.log('' == undefined); // falseconsole.log(false == undefined); // false


Discussion

No Comment Found