Merge object and split array by size, Trộn object và tách array theo size (ok)


Áp dụng trong App
Last updated
Was this helpful?


Áp dụng trong App
Last updated
Was this helpful?
Was this helpful?
function chunkArrayInGroups(arr, size) {
var newArr = [];
for (var i = 0; i < arr.length; i += size) {
newArr.push(arr.slice(i, i + size));
}
return newArr;
}var pi = await chunkArrayInGroups(sub_array2, 100).reduce(async (promise, arr) => {
await promise;
var body2 = {
'app': appid,
'records': arr
};
var resp = await kintone.api('/k/v1/records', 'POST', body2);
console.log(resp);
}, Promise.resolve());
// App 3412