Created
June 13, 2017 04:18
-
-
Save itzsaga/29cc99da607fddff0b066553bf13e37d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // With ES6 Template Literals | |
| data.items.forEach(function (item) { | |
| itemList = itemList.add(`<li><strong><a href='/items/${item['id']}'>${item['name']}</a></strong> | |
| <ul> | |
| <li>Rating: ${item['rating']}</li> | |
| <li>Notes: ${item['notes']}</li> | |
| </ul>` | |
| ) | |
| }) | |
| // With newline slashes | |
| data.items.forEach(function (item) { | |
| itemList = itemList.add('<li><strong><a href="/items/' + item['id'] + '">' + item['name'] + '</a></strong> \ | |
| <ul> \ | |
| <li>Rating: ' + item['rating'] + '</li> \ | |
| <li>Notes: ' + item['notes'] + '</li> \ | |
| </ul>' | |
| ) | |
| }) | |
| // Concatenation | |
| data.items.forEach(function (item) { | |
| itemList = itemList.add('<li><strong><a href="/items/' + item['id'] + '">' + item['name'] + '</a></strong>' + | |
| '<ul>' + | |
| '<li>Rating: ' + item['rating'] + '</li>' + | |
| '<li>Notes: ' + item['notes'] + '</li>' + | |
| '</ul>' | |
| ) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment