Am I doing the bonfires correctly?

I’ve gone through 10 of the basic bonfires, and I’m not sure if I’m doing everything correctly. I don’t know if I’m going through them too fast.

I’m going to discuss specific examples here, so if you haven’t gone through the bonfires and don’t want hints, don’t read further.

  1. The first thing I do is take the recommended things to look up and look them up on w3 instead of MDN. I find it easier to understand.

  2. I’m not looking up solutions or trying to google the challenge as a whole, but I might google a part of the challenge. For instance, on the checking for palindromes challenge, I realized one step in my process would be to remove special characters and spaces. When I first tried it, I got rid of only the first space. I did googling to find that I could do add the /g for global and get rid of all the spaces. Further googling and I found the character class that got rid of everything except underscores (/\W/gi) and the chaining technique for getting rid of all of them at once. I think I found that information on stack overflow. My line of code for this part of the challenge came out as:
    var noSpace = str.replace(/ /g, “”).replace(/\W/g, “”).replace(/_/g, “”);

My approach to the challenge came from my head. ( 1. Remove spaces and special characters 2. convert to lowercase 3. create an array 4. reverse the array 5. join the array to a new string 6. if new string === old string, true else false)

Did I get too much help on this one?

In general, my approach is to break the concept into small steps, and if necessary look up methods that do the steps I’m after. Another thing I found from googling was Math.max(…array). I googled how to find the largest value in an array, after I had created an array of the word lengths on the find the longest word in a string challenge.

So basically I’m wondering if I’m doing too much looking up or if this is an appropriate amount of looking stuff up for my level.

  1. I’m not even really trying to understand recursive functions right now. I’m doing everything with loops. I’m also not particularly concerned with elegance of my code. Is this a problem at this stage?

Any help is appreciated. I just want to make sure I’m not missing the point of the exercises.

I think this is the best approach. As long as you don’t copy complete solutions, you will only learn from searching.

You understand the logic (you can split it into steps) and that is the biggest part. You won’t learn JS if you only use what you already know. Search as much as you can.

No. The most important part (at this point) is that your code is working (and that you know why). When you hit the projects with a lot of JS you will find that your code has to be structured some how.

I really liked this free course: Besides learning a lot about jQuery the instructor points out a lot of best practices.

1 Like

Thanks for the feedback. Glad I’m not screwing myself up here!

Just to add another voice to @bengitter’s assurance - Yep, you’re doing it the right way.

If you come up with the general algorithm for yourself, but need to google things like ‘How do I replace a character in a string’, then you’re fine.

If you google things like ‘Solution to Free Code Camp Palindromes challenge’ you are less fine :slight_smile:


Thanks! That’s what I was thinking, but wanted to be sure.