Closed jkalandarov closed 2 years ago
Probably already figured this one out, but I would guess you have some blank entries in your object
Yeah, figured it out a few days later. Kinda embarrassing now :)
Nothing to be embarrassed about :D
Only know because I have been there, and there will be some poor soul who will have the same issue and come across this post and be like 'This just saved my day!'
Hi,
I have an expected issue with rendering while using for loop. The data object
topCityWeather
is sent from the back-end to the front-end. While rendering data on the browser I have a funny issue: for loop is iterating as twice as expected.//The length of the topCityWeather is 10 items
<% for (var i = 1; i <= topCityWeather.length; i++) { %>
<tr>
<td><%= i %></td>
<td><%= topCityWeather[i].city %></td>
<td><%= topCityWeather[i].temperature + '℃' %></td>
<td><%= topCityWeather[i].humidity + '%' %></td>
<td><%= topCityWeather[i].description %></td>
</tr>
<% } %>