JavaScript the correct way to determine the undefined type

  • 2020-06-22 23:46:13
  • OfStack


  if (reValue== undefined){
    alert("undefined");
    }

Found that the judgment can not be made, finally checked the data to use typeof
Methods:

if (typeof(reValue) == "undefined") {
   alert("undefined");


typeof returns a string with six possibilities: "number", "string", "boolean", "object", "function", "undefined"


Related articles: