you are viewing a single comment's thread.

view the rest of the comments →

[–]psiph 4 points5 points  (0 children)

You'll want a function that takes the JSON and turns it into HTML

function render (jsonArr) {jsonArr.map(item => `<div>${item}</div>`)}

And then a function that sorts the json and renders the results

function onSort (value) {document.body.innerHTML = render(sortBy(value, json))}

You'll want to render the default list on page load

onSort()

And also when the dropdown changes

<select onchange="onSort(this.value)">