mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-14 08:38:08 -05:00
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:
Reference in New Issue
Block a user