<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>数组转字符串</title></head><script> var tt77=[[{a:1,a2:11,a3:111},{a:2,a2:22,a3:222},{a:3,a2:33,a3:333},{a:4,a2:44,a3:444}],[{a:21,a2:211,a3:2111},{a:22,a2:222,a3:2222},{a:23,a2:233,a3:2333},{a:24,a2:244,a3:2444}],[{a:31,a2:311,a3:3111},{a:32,a2:322,a3:3222},{a:33,a2:333,a3:3333},{a:34,a2:344,a3:3444}]]; var timeD=[]; var timeData1=‘‘; var devicePlace=‘大大1‘; for(var j=0;j<tt77[0].length;j++){ var timeData1; for(var i=0;i<tt77.length;i++){ timeD[i]=(tt77[i][j].a)+‘:‘+(tt77[i][j].a2); console.log(timeD[i]); } timeData1+=timeD+‘^‘; } /*截掉最后一个字符*/ var timeData1=timeData1.substring(0,timeData1.length-1); console.log(timeData1); var tt=timeData1.split(‘^‘); console.log(tt); waySeries = { name : devicePlace, data : tt }; console.log(waySeries); //console.log(waySeries);</script><body> </body></html>
时间: 2024-11-06 09:38:31