js & get recursive ids
js & get recursive ids
len = 0; bug
for(let i = 0; i < 3; i++) {
console.log(`i =`, i);
let y = ids.slice(3*i, 3*i + 3);
console.log(`y =`, y, typeof(y));
if(i < len - 1) {
x += (y + `,`);
console.log(`x1 =`, x);
} else {
x += `${y}`;
console.log(`x2 =`, x);
}
console.log(`x3 =`, x);
};
OK
const ids = `101103105`;
let len = ids.length / 3;
let x = ``;
for(let i = 0; i < len; i++) {
console.log(`i =`, i);
let y = ids.slice(0, 3*i + 3);
// let y = ids.slice(3*i, 3*i + 3);
console.log(`y =`, y);
if(i < len - 1) {
x += `${y},`;
} else {
x += `${y}`;
}
console.log(`x =`, x);
};
shit api
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/10284292.html
未经授权禁止转载,违者必究!