@DanCouper and all you experts lurking here,
Please help me understand why this code is not working.
the challenge is:
Use template literal syntax with backticks to display each entry of the result
object’s failure
array. Each entry should be wrapped inside an li
element with the class attribute text-warning
, and listed within the resultDisplayArray
.
Here is my code so far:
const result = {
success: ["max-length", "no-amd", "prefer-arrow-functions"],
failure: ["no-var", "var-on-top", "linebreak"],
skipped: ["id-blacklist", "no-dup-keys"]
};
function makeList(arr) {
"use strict";
// change code below this line
const resultDisplayArray = `${
//used .map() to iterate thru the array and put each failure entry into the li element
arr.map(arr => "<li class='text-warning'>"
+ arr + "</li>")}`;
// change code above this line
return resultDisplayArray;
}
/**
* makeList(result.failure) should return:
* [ `<li class="text-warning">no-var</li>`,
* `<li class="text-warning">var-on-top</li>`,
* `<li class="text-warning">linebreak</li>` ]
**/
const resultDisplayArray = makeList(result.failure);
console.log(resultDisplayArray);
the code does work when I test it on repl.it .i.e the code above does put each entry within the li element!!
here is a screenshot:
Capture|690x367
but when I run it here it gives me this error:
// running tests
resultDisplayArray is a list containing result failure messages.
makeList(...).every is not a function
// tests completed
Please let me know what I am doing wrong