基本数据类型:
underfined,null,string,boolean,number,symbol
Undefined:没有值的变量,其值是undefined.
NaN:是JS中的Number类型,它表示Not A Number(不是数字),任何值和NaN比较都不相等
引用数据类型:
对象(object),数组(array),方法()
判断数据类型的方式:
typeOf:
1.null会判断出空的对象
2.对象,数组都会判断成对象
3.其他正常
typeof 1 // 'number'
typeof '1' // 'string'
typeof undefined // 'undefined'
typeof true // 'boolean'
typeof Symbol() // 'symbol'
typeof [] // 'object'
typeof {} // 'object'
typeof console.log // 'function'
instanceof:
Js种类型转换:
转换数字,转换布尔值,转换字符串