Так как мне избавиться от этого нежелательного "обещания {:" выполнено ", : 1449}" Вывод?function queensAttack(n, k, r_q, c_q, obstacles) {
var ary = [];
var count = 0;
var finalResult = 0;
//Calculating the number of moves for lines without obstacles
if (k === 0 && !obstacles) {
count = ary[0] + ary[1] + ary[2] + ary[3] + (n - 1) * 2;
return count;
} else {
var lent = obstacles.length;
var batSize = lent / 10;
//Declarations of accumulators vales of lines: F1, F2, D2, D1
// --------------------------------------------------------------
function qAttack(batch, p, lastBat) {
//Counting the number of moves taking into account obstacles
} //qattack6()
// --------------------------------------------------------------
let processBatch = async (batch, p, lastBat) => {
return new Promise((resolve, reject) => { //
resolve(qAttack(batch, p, lastBat));
});
};
let processLargeArray = async (bigAr, batchSize) => {
const lastBatch = lent - batchSize;
for (let i = 0; i < bigAr.length; i += batchSize) {
const batch = bigAr.slice(i, i + batchSize);
try {
let results = await processBatch(batch, i, lastBatch); //
finalResult = results;
} catch (error) {
console.error(`Error processing batch ${i / batchSize + 1}:`, error);
}
} //for
return finalResult; //
};
if (lent > 1000) {
return processLargeArray(obstacles, batSize); //
} else {
qAttack(obstacles, 1, 1);
}
} //else
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... ode-bellow