How to set the condition of loop
00:09 13 Jul 2026

If I'm creating a loop inside a function and passing a number as an argument, how can I set my loop condition? If I'm passing one argument, it should run once.

const depostBalance = (amount) => {
    let currentBalance = 0;
    for (let i = 1; i >= ; i++) {
        currentBalance = currentBalance + amount;
    }
    return currentBalance;
}
console.log(depostBalance(5));
javascript loops