类型 | 字面量 | typeof() | |
---|---|---|---|
字符串 | 'shuhhhg' | string | |
数字 | 123 | number | |
布尔 | true、false | boolean | |
空值 | null | object | |
未定义 | undefined | undefined | |
函数 | function(){} | function | |
数组 | [ ] | object | |
对象 | { } | object | |
日期 | new Date | object | |
正则 | /^[A-Z]$/.test() | object | |
错误 | new Error | object |
var s=null;
console.log(typeof(s));
VM647:2 object
var s=undefined;
console.log(typeof(s));
VM683:2 undefined
var s=123;
console.log(typeof(s));
VM705:2 number
var s='hope';
console.log(typeof(s));
VM740:2 string
var s=true;
console.log(typeof(s));
VM791:2 boolean
var s=function(){};
console.log(typeof(s));
VM827:2 function
var s=[2];
console.log(typeof(s));
VM926:2 object
var s={};
console.log(typeof(s));
VM958:2 object