Below explain the difference between null and undefined in JavaScript
The undefined means a variable has been declared but has no value.
var nameTest; console.log(nameTest); //undefined console.log(typeof nameTest); //undefined
null is an assignment value,Variable declared and is an empty value
var nameTest=null; console.log(nameTest); //null console.log(typeof nameTest); //object
Related
String Concatenation in JavaScript