JS

JAVASCRIPT NULL vs UNDEFINED vs EMPTY

1) NULL

EXPLICITLY USED TO DEFINE “NOTING” OR “ABSENT”. var people = ["Jon", "Joy", null];   DATATYPE console.log(typeOf null); OBJECT   COMPARISON null == undefined TRUE null === undefined FALSE null == "" FALSE null === "" FALSE

2) UNDEFINED

A VARIABLE WITHOUT ASSIGNED VALUE var people;   DATATYPE console.log(typeOf undefined); UNDEFINED   COMPARISON undefined == null TRUE undefined === null FALSE undefined == "" FALSE undefined === "" FALSE

3) EMPTY STRING

AN EMPTY STRING var people = "";   DATATYPE console.log(typeOf ""); STRING   COMPARISON "" == null FALSE "" === null FALSE "" == undefined FALSE "" === undefined FALSE