typeof 123 //number 值类型
typeof "123" //String 值类型
typeof true //boolean 值类型
typeof undefined //undefined 值类型
typeof {} //object 引用类型
typeof [] //object 引用类型
typeof null // object 引用类型
typeof console.log //function 引用类型
值类型的修改只是单纯值的复制
引用类型的修改则是地址的修改
强制类型转换
"" == 0 //true 实际上转换为了false == false
100 = "100" //true 100变为了字符串
null == undefined //true 转换为了false == false
console.log(10&&0) //0
console.log("" || "abc") //abc
console.log(!window.abc) //true
判断一个变量是false还是true
var a = 100;
console,log(!!a);
JSON是一种数据格式也只不过是一个JS的对象
json.stringify({a:10 , b:20}) 将对象转换为字符串
JSON.parse('{"a":10 , "b":20}') //将字符串转换为对象