函数的几种检测方法

数据类型 function

    //1.1 typeof 来检测函数类型
    function test1(){
      console.log("呵呵");
    }
    console.log(typeof test1); //function

    //1.2 instanceof
    console.log(test1 instanceof  Function); //true

    //1.3  Object.prototype.toString.call();
    console.log(Object.prototype.toString.call(test1)); // "[object Function]"

posted on 2017-12-14 20:48  ouruixi  阅读(418)  评论(0)    收藏  举报

导航