I just don't understand anything up to this point

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 = [];
// Only change code above this line

return failureItems;

const failuresList = makeList(result.failure);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36.

Challenge: Create Strings using Template Literals

Link to the challenge:

If you really don’t understand anything up to this point then you probably should go back to the beginning and review all the material up to this point. But perhaps I shouldn’t take you literally and you are just a little frustrated? Can you give us a better idea of exactly what you don’t understand so we can help you?


This specific challenge introduces a cool feature: integrating string variables into a template on the fly easily.

Before this, let’s say you have a name, and you want to generate a personalized greeting, the string has to be created like this:

const name='Jessica';

const greeting='Hello, '+name+', how are you?';

But with template literals, you can do this:

const greeting=`Hello, ${name}, how are you?`;

Please provide us with some code so we know how to help. If your title is true then I suggest going back to review, starting with the first topic you have trouble with.


So I’m very new to coding. When I asked for help a week ago, I was already starting over from the beginning. I understand it, I just can’t remember what to recall or how to implement what I’ve just reviewed. I guess I just do this enough outside of codecamp?

So I’m very new to coding. When I asked for help a week ago, I was already starting over from the beginning. I understand it, I just can’t remember what to recall or how to implement what I’ve just reviewed. I guess I just do this enough outside of codecamp?

What do you not understand about this challenge? What have you tried? Please show us the code you have tried to write to solve this.

 // Only change code below this line
  const failureItems = [];
  for (var i = 0; arr.length > 0; i++){
    return [`<li class="text-warning">${arr[i]}</li>`]
  // Only change code above this line

And which test cases are failing?

You probably don’t not a return statement inside of a loop. Then your loop only runs once.

failuresList should be an array containing result failure messages.

Three other parameters seem to pass just fine.

Ok. So you are returning inside of your loop an array with a singer value instead of building an array of strings element by element.

Sorry man, I feel stupid, what do you mean by that?

This keyword immediately and completely stops the function and ‘returns’ the value to its right back to where the function was called.

Do you want to immediately and completely stop the entire function in the middle of the loop, before every single loop iteration has a chance to execute?

1 Like

Ah I see. So, if I take it out, do I instead add

 failureItems[`<li class="text-warning">${arr[i]}</li>`];

Otherwise, I get an infinite loop…

So this worked. I fixed arr.length > 0 to i instead so it would then stop the infinite loop. Then, since failureItems is already established as an array, I would push the next tex-warning. I know it passed the tests, but is that how you would break it down to explain it?

for (var i = 0; arr.length > i; i++) {
  failureItems.push(`<li class="text-warning">${arr[i]}</li>`);
  // Only

hi, this code works great and is exactly the logic that should be done. There are 3 parts to this logic:

  1. create an empty array (here named failureItems)
  2. for every item in the passed in parameter arr, push an element into failureItems, and like you said, since failureItems is initialized as an array, pushing new elements is not a problem.
  3. return failureItems

Two things of note,
the convention is to place i on the left side of expressions in the for loop condition. e.g. for (var i = 0; i < arr.length; i++)
and try to use let and const as per the new ES6 standard in place of var where possible.

I am not sure if this is covered at this point in the curriculum, but the logic I described is actually exactly what Array.prototype.map() method does. It takes an array, and “maps” it into another. So if you are comfortable with it, you can modify your code to use .map() instead.


For long term benefits, I’d recommend going back to the first challenge where it stopped making good sense to you, and this time if, say ,a word representing a concept is unfamiliar to you, look up and try to understand that word /concept before moving on with the challenges.

You study pace might slow down to a crawl at first but it will pick up speed and likely exceed what the speed would be if you didn’t do the above.

1 Like

Thanks! Mapping hasn’t been yet explained, but this did really help.

1 Like

Definitely noted. I can’t agree more

I agree as well. Also, just a few tips I find that work really well for me when studying/learning programming languages (or anything for that matter)…

freeCodeCamp is a wonderful, valuable resource, but it’s not the end all be all. It’s a starting point that introduces us to things and then it is up to us to dig deeper and research more on our own. Sometimes another resource explains it in a way that makes more sense to a particular learning/thinking style.

  • If you are working on a device with enough screen real estate, keep another browser window or multiple tabs open with other resources and examples to compliment the lessons ( w3schools , MDN Javascript (docs), YouTube Videos , etc).

I use a PC with 2 monitors. The second monitor extends my desktop (where I put a second browser window with many tabs.

A lot of people will have a set up where they have reference material open on one screen, and the code they are working on open on their main screen to ease their workflow.

Basic (non-gaming) monitors are pretty cheap these days, so investing in a second monitor is so totally worth it in my humble opinion (if your laptop/desktop video card supports it).

  • Keep the current challenge open in one tab and the course list Javascript Courses Curriculum open in another tab open so you can quickly pop back into a section if you need to review something for the current challenge.

  • Take notes in notepad or a physical paper notebook.

I find that as a beginner, it is difficult to remember all the syntax, key words, methods, and then on top of that, all the logic that is going on that may be hard to grasp and track.

  • Console.log(); is your friend. Use it at various points in your code to help you see what is going on (what is the value of this variable at this point in my code, etc) and also use tools like jsfiddle where you can play around with your code or try things out and see what happens.

  • In the beginning, focusing on the concepts is way more important than remembering all the syntax. You can easily look up the syntax. Over time as you code more, you will start to memorize it and retain it simply due to the repetition.

  • Take your time, it’s not a race to the finish. What good is it to rush through and not really learn it and forget everything the next day. I am so guilty of this and now finding it works better if I slow my pace. I’d rather learn it well.

  • Take frequent breaks to prevent “brain fry” or mental overload and to ponder the material you just learned.

Perhaps you already do these things. I find these things help me a lot for reviewing and retention of the material.

Seems like you are getting the hang of it… learning anything new requires struggle. As they say…“no pain, no gain”. Hang in there and keep at it! The perseverance will eventually pay off. Don’t get discouraged, a lot of us are in the same boat. It will start to click. :smiley:

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