js中数组, JSON的与字符串的处理

1. JSON转字符串

var jsonStr = {"name": "xiaoming", "sex": "男"}
JSON.stringify(jsonStr)

2. 数组转字符串

var arr= ["A", "B", "C", "D"];
var str = arr.toString(); // Returns a string representing the specified object.
var str1 = arr.join() // Joins all elements of an array into a string. var str2 = arr.join(","); // 给每个元素之间加入 "," 隔开,并转字符串
上一篇:python执行shell获取硬件参数写入mysql


下一篇:8款实用的Jquery瀑布流插件