Saying not defined confusing

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

const result = {
success: ["max-length", "no-amd", "prefer-arrow-functions"],
failure: ["no-var", "var-on-top", "linebreak"],
skipped: ["no-extra-semi", "no-dup-keys"]
};
function makeList(arr) {
// Only change code below this line
const failureItems = [];
for (let i= 0; i < arr.length; i++) {
failureItems.push('<li class="text-warning">$(result,failure[i]</li>')

}

return failureItems;
}

const failuresList = makeList(result.failure);


  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36

Challenge: Create Strings using Template Literals

Link to the challenge:

it is not defined outside the function. You can use console.log(failuresList) outside the function as that is defined, or console.log(failureItems) inside the function

The main problem lies in this piece of code.

  1. You have to use backticks.

  1. The syntax you have used for accessing the failure is not correct.
    The syntax should be: ${variable} not $(variable )

  2. You have used a comma in result,variable instead of a " . "

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.