博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

jq源码判断数据类型

Posted on 2019-03-01 17:00  和风细雨汪汪  阅读(217)  评论(0编辑  收藏  举报

4.Object.prototype.toString.call()

复制代码
 1 var a = Object.prototype.toString;
 2 
 3 console.log(a.call("aaa"));
 4 console.log(a.call(1));
 5 console.log(a.call(true));
 6 console.log(a.call(null));
 7 console.log(a.call(undefined));
 8 console.log(a.call([]));
 9 console.log(a.call(function() {}));
10 console.log(a.call({}));
复制代码