You keep re-declaring the failureItems on each loop iteration, and it is only scoped to the loop body. You cannot reference failureItems outside of the loop, and even if you could, you need to fix the fact that you keep overwriting the variable on every loop iteration.
The desired output shown in the instructions has single quotes around the strings to denote that they are strings but you don’t actually include those in the output.
Also, how do you include a variable in a template literal? You are missing some syntax.
Why don’t we include the single quotes? Also, if I cannot include var here, then it is let but I am having difficulty understanding the difference it would make here.
Because you are using backticks to define the string in your code instead of single quotes, so the single quotes are unnecessary.
I didn’t say you couldn’t include a variable in the template literal. I said that the syntax you are using is not exactly correct. Look at the example in the instructions to figure out what you are missing.
But aren’t the single quotes in this example a part of the string? As far as I could understand, they are not used to specify that it is string but they are supposed be seen in the output.
No, they aren’t, that’s what I was trying to explain. In the example output shown in the instructions, the single quotes signify that strings are stored in the array but you don’t literally add single quotes to the strings in your output.
This means that you have an array of strings. So in your function you want to create an array of strings. You are creating the strings using template literals, which use the backticks instead of single/double quotes. You don’t need to additionally add the single quotes at the beginning/end of the string you create.
Yes, as @bbsmooth said the issue was with the syntax. The variable after the $ sign should be in curly brackets { }. That’s also explained in the challenge but I was just not careful enough.