Loop n times without mutable variables

2 replies
  1. japanfever
    japanfever says:


    //japanfever alnternative, userkey E3839EE383AAE382AAE9B3A9E38388E383ACE383AD
    document.querySelector('ul').innerHTML = (function repeat(i, sum) {
    if (i >= 10) return sum;
    return repeat(i + 1, sum + `${i}`);
    })(0, '');

    ¯\_(ツ)_/¯

Comments are closed.