简单的代码(递归)
function arrToStr(objarr) {
var arrLen = objarr.length;
var row = "[";
for (var i = 0; i < arrLen; i++) {
if (objarr[i] instanceof Array) {
row += arrToStr(objarr[i]) + ",";
} else if (typeof objarr[i] == "object") {
row += JSON.stringify(objarr[i]) + ",";
} else {
row += objarr[i].toString() + ",";
}
}
row += "]";
return row;
}
网友评论