JS基础——数据类型判断typeof、instanceof、Object.prototype.toString
栏目: JavaScript · 发布时间: 6年前
内容简介:对应测试结果如下:
typeof instanceof Object.prototype.toString
对应测试结果如下:
typeof test
|
instanceof
|
Object.prototype.toString.call(test)
|
|
| var test = 'xuriliang'; | string |
test instanceof String //false
|
[object String] |
| var test = 27; | number |
test instanceof Number //false
|
[object Number] |
| var test = true; | boolean |
test instanceof Boolean //false
|
[object Boolean] |
| var test = [1,2,3]; | object |
test instanceof Array //true
|
[object Array] |
test instanceof Object //true
|
|||
| var test = null; | object |
test instanceof Object //false
|
[object Null] |
| var test = undefined; | undefined |
test instanceof Object //false
|
[object Undefined] |
| var test = new String('xuriliang') | object |
test instanceof String //true
|
[object String] |
test instanceof Object //true
|
|||
| var test = new Number(27) | object |
test instanceof Number //true
|
[object Number] |
test instanceof Object //true
|
|||
| var test = new Boolean(true) | object |
test instanceof Boolean //true
|
[object Boolean] |
test instanceof Object //true
|
|||
| var test = new Array(1,2,3) | object |
test instanceof Array //true
|
[object Array] |
test instanceof Object //true
|
|||
| var test = function(){} | function |
test instanceof Function //true
|
[object Function] |
test instanceof Object //true
|
|||
| var test = /d/ | object |
test instanceof RegExp //true
|
[object RegExp] |
test instanceof Object //true
|
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
大数据大创新:阿里巴巴云上数据中台之道
邓中华 / 电子工业出版社 / 2018-11 / 99
阿里巴巴云上数据中台正服务着阿里生态中的数十个业务板块、百余家公司、千万级客户,在帮助决策层看清甚至决定业态走向的同时,在上万个业务场景中应用并催生创新。 《大数据大创新:阿里巴巴云上数据中台之道》基于作者在阿里巴巴的十年大数据从业经历,精彩演绎云上数据中台之道。《大数据大创新:阿里巴巴云上数据中台之道》基于大数据探索的大趋势,讲述阿里巴巴云上数据中台顶层设计,再以实际案例详述阿里巴巴云上数......一起来看看 《大数据大创新:阿里巴巴云上数据中台之道》 这本书的介绍吧!