Home > Article > Web Front-end > Use typeof method to determine undefined type_javascript skills
For js to determine the undefined type, use the typeof method. typeof returns a string, one of which is undefined.
js determines undefined type
if (reValue== undefined) { alert("undefined"); }
I found that I couldn’t tell, so I finally checked the information and needed to use the typeof method:
if (typeof(reValue) == "undefined") { alert("undefined"); }
typeof returns a string, there are six possibilities: "number", "string", "boolean", "object", "function", "undefined".
Be careful when using it.