可以清楚的看到 拿到数字 字符串 对象 函数 数组 通过.slice(8,-1) 可以拿到类型的名称 ,可以做你想要的操作
Object.prototype.toString.call(222) "[object Number]" Object.prototype.toString.call('222') "[object String]" Object.prototype.toString.call({}) "[object Object]" Object.prototype.toString.call(function f(){}) "[object Function]" Object.prototype.toString.call([]) "[object Array]" Object.prototype.toString.call(function f(){}).slice(8,-1) "Function"