Create Strings using Template Literals

resultDisplayArray expects an array of strings as the return type. By putting template literals outside the array, you’ve essentially turned the array into a string.

Instead it should look like this

const resultDisplayArray = [`<li class=....`, `<li class=...`]

If instead you want dom nodes, then it’ll look like this

const resultDisplayArray = [<li class="text-warning">`${arr[0]}`</li>, ...]

Only put template literals around what you actually want to be a string. And if you want to use variables, use interpolation ${}

1 Like