如下代码所示: var str = 'agsjdj23bsnqk2ndxn2dnd87hsj9n1ms29010ssh22isn1m2ms'; var data1 = []; console.log(str.length); for (var i = 0; i < str.length; i+2) { // data1 = data1.concat(str.slice(i,i+2)); // console.log(str.slice(i,i+2)); console.log(i); } console.log(data1);
添加回答
举报
0/150
提交
取消