DEV Community

Discussion on: Why Does JavaScript Do THIS? - Question #1

Collapse
 
katnel20 profile image
Katie Nelson • Edited

Your code is saying to use <li>${name}</li> for the listOfNames each time another name appears in the names array. If you were to slow down the result, you would see each name appear on top of the previous one. The += says to add it to whatever is already there. This way you will see them all next to each other.

Collapse
 
mzahraei profile image
Ardalan

Almost right