I have a null variable that is behaving weird. For some reason I can't seem to detect whether or not it is null! The var is called emailFromUrl.
console.log(emailFromUrl); //returns null
console.log(emailFormUrl.toString()); //returns null
console.log(emailFromUrl === null); //false!
console.log(emailFromUrl != null); //true!
console.log(typeof emailFromUrl); //string
console.log(!emailFromUrl); //false!
console.log(emailFromUrl === ""); //false
What the heck is going on here?
The answer:
console.log(emailFromUrl === 'null'); //true!
The unfiltered console log:
Test71 | emailFromUrl : null | emailFromUrl === null : false | emailFromUrl != null : true | emailFromUrl.toString() : null | typeof emailFromUrl : string | !emailFromUrl : false | emailFromUrl === "" : false | emailFromUrl === "null" : true
console.log(typeof emailFromUrl);?not equal to null.var emailFromUrlor that it's defined as nullvar emailFromUrl = ''"null"instead ofnull.