Use the typeof method to determine the undefined type
- 2020-03-30 03:56:34
- OfStack
With respect to the js undefined type, use the typeof method, typeof returns a string, one of which is undefined.
Js determines the undefined type
if (reValue== undefined)
{
alert("undefined");
}
It was found that the judgment could not be made, and the typeof method was used to check the data at last:
if (typeof(reValue) == "undefined")
{
alert("undefined");
}
Typeof returns a string in six possibilities: "number", "string", "Boolean", "object", "function", "undefined".
Be careful when using it.