bmjaczynski
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by bmjaczynski
-
-
For this example:
var fruits, text, fLen, i; fruits = ["Banana", "Orange", "Apple", "Mango"]; fLen = fruits.length; text = "<ul>"; for (i = 0; i < fLen; i++) { text += "<li>" + fruits[i] + "</li>"; } text += "</ul>";
why does the last line output as </ul> instead of <ul></ul>? Since it is using the += operator.
Looping Arrays
in JavaScript
Posted
Yes it's correct code, but I'm new to coding so it seems my logic is flawed when I try to break it down and I'm not sure why. Why isn't the variable 'text' being looped since it's looping what looks to me like:
Same for the last line: