Object.prototype.toString.apply()方法得到对象类型

Object.prototype.toString.apply([1,2])    //"[object Array]"
Object.prototype.toString.apply('str')    //"[object String]"
Object.prototype.toString.apply(1)        //"[object Number]"
Object.prototype.toString.apply(null)     //"[object Null]"
Object.prototype.toString.apply()         //"[object Undefined]"
Object.prototype.toString.apply(function(){})      //"[object Function]"
Object.prototype.toString.apply(true)     //"[object Boolean]"
Object.prototype.toString.apply(new Object())     //"[object Object]"

 

posted on 2018-02-28 14:26  木杉彬彬彬  阅读(2011)  评论(0编辑  收藏  举报