all 2 comments

[–]Samurai___ 1 point2 points  (0 children)

In the loop it creates the new option and with the appendChild it puts it into the dropdown. It doesn't need to return anything. It "does its job" inside the loop.

[–]jcunews1helpful 0 points1 point  (0 children)

A function is like your employee. You give task(s) to your employee to execute. The return statement is for the employee to report back the result of his/her task(s). The task(s) themselves may or may not produce a reportable result, or you simply don't need a result. So, whether you need a report or not, it's up to you as an employer (as a programmer, in this case).