/**
* 返回数据类型
*
* @return "null", "undefined",
* @return "Number", "String", "Boolean", "Symbol",
* @return "Array", "Object", "Function", "RegExp"
*
*/
let _toString = Object.prototype.toString;
function toRawType (value) {
console.log("_toString.call(value)", _toString.call(value))
return _toString.call(value).slice(8, -1)
}
let configs = {
defNull: null,
defUndefined: undefined,
num: 20,
str: 'abcjsdkjdsjkfls',
bol: true,
arr: [1, 2],
sym: Symbol('hei'),
person: {
age: 18
},
fn: (_) => (_),
reg: /^Chapter [1-9][0-9]{0,1}/
}
for (let key in configs) {
let val = configs[key]
console.log(val, toRawType(val))
}