Loop n times without mutable variablesJuly 13, 2017/in HTML5, JavaScript/by Génesis http://gengns.com/wp-content/uploads/2015/05/logo-onepage-300x66.png 0 0 Génesis http://gengns.com/wp-content/uploads/2015/05/logo-onepage-300x66.png Génesis2017-07-13 13:02:452017-07-13 13:04:50Loop n times without mutable variables
japanfever says: July 31, 2017 at 05:18 //japanfever alnternative, userkey E3839EE383AAE382AAE9B3A9E38388E383ACE383AD document.querySelector('ul').innerHTML = (function repeat(i, sum) { if (i >= 10) return sum; return repeat(i + 1, sum + `${i}`); })(0, ''); ¯\_(ツ)_/¯
//japanfever alnternative, userkey E3839EE383AAE382AAE9B3A9E38388E383ACE383AD
document.querySelector('ul').innerHTML = (function repeat(i, sum) {
if (i >= 10) return sum;
return repeat(i + 1, sum + `${i}`);
})(0, '');
¯\_(ツ)_/¯
Nice alternative dude!