标签:typeof str 格式 style first lan js对象 ast var
// js对象和json 的区别 var friend ={ firstname:‘zhang‘, lastname:‘cl‘, address:null, // address:‘‘, // address:undefined, }; // var str = ‘{"name":"alan"}‘; // json 格式对象 var json ={ "name":"alan", "age":"23", "gender":"female", }; // json 格式数组 var arr =[ { "name":"alan", "age":"23", "gender":"female", }, { "name":"kitty", "age":"23", "gender":"female", }, { "name":"tom", "age":"23", "gender":"male", } ] var json2 = JSON.parse(str); // json 格式的对象 // var str = JSON.stringify(friend); var str2 = ‘{"firstname":"zhang","lastname":"cl","address":null}‘; var json3 = {"firstname":"zhang","lastname":"cl","address":null} // console.log(str); console.log(typeof(json3));
标签:typeof str 格式 style first lan js对象 ast var
原文地址:http://www.cnblogs.com/alan-alan/p/7512511.html