+ 1

functions within loop

Why cant i make functions within the loop here on sololearn in javascript. this is will be highly DRY and even ineffective if we have to manually put addEventListeners to all the buttons on the page etc??

21st Sep 2017, 11:20 AM
adeel salim
adeel salim - avatar
4 Réponses
+ 1
no we cant.. it says dont make a function inside a loop
22nd Sep 2017, 9:13 AM
adeel salim
adeel salim - avatar
+ 1
i am trying to addEventListener to all buttons on the pg.. i think it makes sense to do that inside a loop instead of adding them individually to each button
23rd Sep 2017, 7:28 AM
adeel salim
adeel salim - avatar
0
Ehm...we can...
21st Sep 2017, 11:41 PM
Rose Sevenyears
Rose  Sevenyears - avatar
0
Guess its more like tip or about Creating functions inside loop which have no sence.
22nd Sep 2017, 11:36 AM
Rose Sevenyears
Rose  Sevenyears - avatar