I need help with defining a variable, I want to make a new variable named mainPendingTotal I want it to be equal to the pendingTotal if (x.Username == config.mainAccount) How do I do this? Below is code. It is not full code.
.then(
axios.spread((current, pending) => {
console.log(`${x.Username.cyan}\nCurrent: ${current.data.robux} R$\n${`Pending: ${pending.data.pendingRobuxTotal} R$`.gray}`);
if (x.Username == config.mainAccount) {
total.push(current.data.robux);
pendingTotal.push(pending.data.pendingRobuxTotal);
} else {
total.push(current.data.robux);
pendingTotal.push(pending.data.pendingRobuxTotal);
}
})
)
.catch((message) => {
console.log(`${x.Username}: Error ${message.response}`.red);
total.push(0);
pendingTotal.push(0);
});
}
while (total.length !== file.length || pendingTotal.length !== file.length) {
await new Promise((r) => setTimeout(r, 100));
}
let totalAdded = total.reduce((a, b) => a + b, 0);
let pendingTotalAdded = pendingTotal.reduce((a, b) => a + b, 0);
let allTotal = totalAdded + pendingTotalAdded;
console.log(`${`\nTotal`.cyan}\nCurrent: ${totalAdded} R$\n${`Pending: ${pendingTotalAdded} R$`.gray}\n${`${allTotal} R$`.green}\n\nAfter Transfer: ${Math.round(allTotal * 0.7)} R$`);
I tried playing around with the code, making the variable being equal to what I already had for the if (x.Username == config.mainAccount)
, I was expecting it to be able to define it, but it ended up giving me an error.