I rendered data from my objects to the DOM perfectly by using using arrow function without curly braces.
I tried adding curly braces after the same arrow function. The DOM will not render any data.
CODE WORKS WITHOUT CURLY BRACES AFTER ARROW FUNCTION
function displayMatches () {
const matchArray = findMatches(this.value, cities)
console.log(matchArray)
const html = matchArray.map(place =>
`<li>
<span class="name">${place.city}, ${place.state}</span>
<span class="population">${place.population}</span>
</li>`
).join('')
suggestion.innerHTML = html
}
THE SAME CODE BREAKS WITH CURLY BRACES AFTER ARROW FUNCTION
function displayMatches () {
const matchArray = findMatches(this.value, cities)
console.log(matchArray)
const html = matchArray.map(place => {
return
`<li>
<span class="name">${place.city}, ${place.state}</span>
<span class="population">${place.population}</span>
</li>`
}).join('')
suggestion.innerHTML = html
}