your resultDisplayArray isn’t actually an array – it’s one big string – so each li element should be one item in the array. Additionally, I believe the tests expect that there’s no white space before or after ${result.failure} so within the element you should probably also remove that space.
What @lekha wrote; and consider using one of the higher-order functions that loops through an array, does something to each item based on a callback you passed to it, and gives out a new array.
i changed the code snippet to the following, there is still an issue where it commplains that element is not a function, using element as a parametre for each individual entry, below is the changed snippet:
const resultDisplayArray = result.failure.map(`element => <li class="text-warning"> element </li>`);
// change code above this line
return resultDisplayArray();```
First of all, you need to look at how this function you’re modifying is being called. Down at line 23 (the very bottom), your function is being called like this:
Meaning that the target array (result.failure) is being fed to your function already; thus no need for the result.failure part in your snippet.
Second, you are consuming map() wrong; the callback should take an array item as the argument and perform the logic required to complete this task. But what you’re doing is just passing a string to map().
Check MDN’s documentation on map() again to see how to consume it correctly.
Finally, you’re supposed to return an array; but instead, what you do in the snippet is returning whatever this function resultDisplayArray() returns; but this function does not exist in this program.
Btw, when posting code snippet that is more than one line, try keeping the triple back ticks on top of and beneath your code, like this:
```
Code snippet goes here
```
Otherwise you got the trailing back ticks, which makes the snippet kinda hard to read.
The source of the problem now is the two white spaces around ${arr} as the expected outcome should not have them.
By removing the white spaces, your solution works just fine; but for the sake of readability, I still suggest you to name the variable that refers to each array element something other than arr (like item, for example). Since arr is already taken as makeList()'s parameter name, this naming can be confusing.