Snippet to convert array to HTML list items

This commit is contained in:
Arjun Mahishi
2017-12-19 23:33:05 +05:30
parent d7c06700f8
commit fd008df60a

View File

@ -0,0 +1,10 @@
### arrayToHtmlList
Converts the given array elements into <li> tags and appends them to the list of the given id.
```js
const arrayToHtmlList = (arr, listID) =>arr.map(item =>document.querySelector("#"+listID).innerHTML+=`<li>${item}</li>`);
```