Reverse a String - Where can I learn these advance functions?

Tell us what’s happening:

[spoiler alert] this is my answer to the lesson using what I’ve learned from the previous javascript lesson. However, when I check the hint for the model answer, I found that I can actually simplify the function with just one line of code with these advanced functions like split(), reverse(), join(). However, the problem is that these functions are not taught in the previous lessons, I have no idea that they even exist and we can only find and learn them from other websites like w3school.

This has also happened fequently when I was doing the ES6 challenges previously. I do not find this satisfying because it means I can’t really learn javascript only by studying in this FCC javascript curriculum progressively. I am also afraid that there are upcoming challenges that I’ll get stuck because the only way to complete them is to use functions that were not introduced in the curriculum before. I don’t like checking the hints before I can complete the challenge but these confusing challenges might force me to.

The above comment might look like pure ranting. I guess my question is that does FCC actually require the student to study some other supplemental books or courses along with their curriculum? Or do you guys have suggestions on whether a coding novice like me should study some other courses before entering this FC javascript curriculum?

I searched a bit in the forum. It seemed everyone is just fine with using these functions to complete the challenge. I am confused. Sorry for the bad English it is not my first language.

Your code so far

[spoiler]
function reverseString(str) {
  let Regex = /\w|\s/ig;
  let temp = [];
  temp = str.match(Regex);
  console.log(temp);
  let rev = "";
  for (let i = str.length-1 ; i>=0; i--){
    rev = rev + temp[i];
    console.log(rev);
  }
  return rev;
}

reverseString("Greetings from Earth");
[\spoiler]

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/reverse-a-string

1 Like

That is correct! FCC does not take you step by step through every thing there is to know, but ito does encourage you to do your research, so that you can find this information. On every challenge page is a reminder to Read-Search-Ask with a link to it for more information about what to do when you get stuck.

I will admit, not everyone likes this learning style, but I think developing the skills that Read-Search-Ask teaches was integral to my ability to find answers and figure out what I need to solve any problem. Sure, they could tell us exactly what to do to solve the challenges, but that would not help us once we are beyond this and have to figure out how to solve problems on our own.

So, consider it a matter of perspective? Instead of being unsatisfied to find out that there are other methods you could use to solve a problem, enjoy having been able to solve it on you own witout those methods, and now apply these new methods youve learned to your future challenges, If you do that…keep applying what you learn as you learn it, and research when you need help, you will not get stuck and unable to complete the course, quite the opposite, I promise you.

btw, if you put in code to a challenge wrap it in [spoiler] [/spoiler] tags so that someone who isnt ready to see the answer wont stumble on it :slight_smile:

Yes, to be blunt. I have problems with the ES6 section, for the reasons you enumerate. But. You are on the algorithms section, and you need to look things up - it’s supposed to challenge you and not hold your hand, that’s the point. This is a very basic exercise, and it gets a lot harder. FCC cannot teach every single function in the standard library, so if you aren’t aware of these functions by this point, you need to look up what they do and how you use them.

thank you very much for the advice. Yes this is what i’m going to do as I continue with the challenges. and FCC is free and already very comprehensive so what can i ask for more :slight_smile: but only thing that bugs me is that it mean’s i’ll have to learn the advance functions in a more disorganized way, which i don’t quite like. But I’ll take it!. Thanks!

thank you for the advice. that is a good attitude that i should adapt to. shouldn’t take FCC for granted, I should rely on myself

Nah not at all…it will be no different than this challenge you just went through. You take the time to figure out how to solve it on your own, then look at the hints or discussions about the challenge to find other ways people have solved it… now you know something new. Next time a situation comes up, you will have knowledge of this method to try using it, or research it to see if its something that would work for the problem you are trying to solve.

Learning as you go along and picking things up as you do research on problems you are trying to solve is actually far more organized and more relevant too, than just learning a bunch of methods upfront before you come across a problem where you can see its usefulness and how they work,

1 Like

Thank you so much cndragn :smiley:

1 Like