Difference between Null and Undefined ( JS )
Published in
2 min readApr 27, 2018
Null vs Undefined // code4mk // Mostafa Kamal
Null and Undefined both are falsy value in JavaScript .
# Null
- object ( typeof)
- empty
- not exist
- must be defined
let name = 'kamal';
console.log(name.match('jamal'));
// output: null
# Undefined
- declare variable but value not define
- undefined ( typeof)
let name;
console.log(name);
// output: undefined
null == undefined
// output : true [ equality rules]
.
null === undefined
// output : false [identity rules]
# Resources