//检测类型
        var str = "Hello World";
        if (typeof str=="string") {//使用typeof来判断对象类型的一个例子
            
        }
        if (str.constructor==String) {//使用构造函数属性来判断对象的类型
            //constructor 属性在每个对象中都存在,并一直指向创建它的函数
        }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-03
  • 2021-06-29
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
  • 2022-01-09
  • 2022-12-23
相关资源
相似解决方案