jsはjs関数、変数が存在するかどうかを判断する簡単な例示コードです。


コアコード

//         
function isExitsFunction(funcName) {
  try {
    if (typeof(eval(funcName)) == "function") {
      return true;
    }
  } catch(e) {}
  return false;
}
//         
function isExitsVariable(variableName) {
  try {
    if (typeof(variableName) == "undefined") {
      //alert("value is undefined"); 
      return false;
    } else {
      //alert("value is true"); 
      return true;
    }
  } catch(e) {}
  return false;
}
より多くの判断はこの記事を参照することができます:https://www.jb51.net/article/67551.htm