//去除空格 function trim(str) { return str.replace(/\s|\xA0/g,""); } /** *js数组转json * */ function arrayToJson(o) { var r = []; if (o==undefined||o==null) return "null"; if (typeof o == "string") return "\"" +…
var str1 ='[{"name":"kevin","age":18},{"name":"rose","age":16}]'; String.prototype.transArray=function(){ var str =this.replace(/\[/,''); var newstr = str.replace(/\]/,''); var arr1 = n…