1.数组转换成字符串
var a,b;
a=[0,1,2,3,4];
b=a.jion(',');
console.log(b);
b="0,1,2,3,4";
2.字符串转换成数组
b="0,1,2,3,4";
a=b.split(",");
console.log(a);
a=[0,1,2,3,4];
3.对象转换成字符串
var c, d; c={id:"1",name:"测试"};
d=JSON.stringify(c);
console.log(d);
d="{"id":"1","name":"测试"}";
4.字符串转换成对象
d="{"id":"1","name":"测试"}";
c=JSON.parse(d);
console.log(c);
c={id:"1",name:"测试"};