JSON.stringify(obj)将JSON转为字符串。JSON.parse(string)将字符串转为JSON格式;
var a={"name":"tom","sex":"男","age":"24"}; var b='{"name":"Mike","sex":"女","age":"29"}'; var aToStr=JSON.stringify(a); var bToObj=JSON.parse(b); var queryOrder = jQuery.parseJSON(data);alert(typeof(aToStr)); //string alert(typeof(bToObj));//object数字,字符串互转
parseInt("1212blu");//1212var a=1212;a.toString()//"1212"四舍五入保留小数点后几位
var n = 123456.789; n.toFixed(0); // "123457" n.toFixed(1); // "123456.8"新闻热点
疑难解答