获取变量数据类型
1、获取检测变量的数据类型
typeof可用来获取检测变量的数据类型
var num=10; console.log(typeof num); //number var str=‘abc‘; console.log(typeof str); //string var flag=true; console.log(typeof flag); //boolean var vari=undefined; console.log(typeof vari); //undefined var timer=null; console.log(typeof timer); //object
2、字面量
字面量是在源代码中一个固定值的表示法,通俗来说,就是字面量表示如何表达这个值
原文:https://www.cnblogs.com/wxdddm/p/12625498.html