JS数据类型:
5种基本数据类型,number,string,null,undefined,Boolean
一种引用数据类型object
// JS:5种基本数据类型,number,string,null,undefined,Boolean
//一种引用数据类型object(arr,function,object)
var res1=typeof(null);
console.log(res1);//object
var res2=typeof(undefined);
console.log(res2);//undefined
例题:
var a=100;
var b=a+20;
var c=typeof(b);
//问c的数据类型是什么?
var res3=typeof(c);
console.log(res3);//string
//typeof可以检测未声明的变量
let res4=typeof(f);
console.log(res4);//undefined 未报错
//typeof用来检测字符串与数字
console.log(typeof(99));//number
console.log(typeof('99'));//string