String concat code blocks were not equivalent.

If the array is empty, the "bad" code will return `<ul></ul>` and the "good" code will return `<ul><li></li></ul>`.

Although I would prefer this over the for loop:

    function inbox(messages) {
      items = messages.map(function(message) {
        return '<li>' + message.message + '</li>';
      });

      return '<ul>' + items.join('') + '</ul>';
This commit is contained in:
Joe Frambach
2015-03-27 10:40:15 -07:00
parent d8564cfaed
commit 3dc4b5edc8

View File

@@ -250,10 +250,10 @@
items = [];
for (i = 0; i < length; i++) {
items[i] = messages[i].message;
items[i] = '<li>' + messages[i].message + '</li>';
}
return '<ul><li>' + items.join('</li><li>') + '</li></ul>';
return '<ul>' + items.join('') + '</ul>';
}
```