Where are yall learing the functions that FCC hasn't gone over

Hello,

I’m deep into the javascript challenges now and I keep running into instances in which the suggested solution in the “hint” section use functions that FCC has never gone over.

For example, I came up with the solution below for the “sum all numbers in a range” challenge but its pretty long and inelegant. When I checked the Hints tab, most solutions used Math.min, Math.max, Math.abs and other solutions I haven’t come across yet. Where can I go to learn to learn functions such as these which are not covered by fCC?

   **Your code so far**

function sumAll(arr) {
let newArr = arr.sort((a,b) => a-b);
let range = [];
for (let i = newArr[0] + 1; i < newArr[newArr.length-1];i += 1){
  range.push(i)
}

let fullArr = newArr.concat(range) ;
let sum = fullArr.reduce((num1, num2) => num1 + num2 ) ;
return sum

}


sumAll([1, 4]);
   **Your browser information:**

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

Challenge: Sum All Numbers in a Range

Link to the challenge:

There are too many built in methods in JS to go over exhaustively. If we did, 99% of people would quit out of boredom. I imagine that it is a balance between giving the most information and keeping the widest range of people interested.

It is a good habit to get in looking these things up. Google “mdn math” and look at what is available in that module. Then look at the array and object prototype methods. Get in the habit of doing research. Every time I encounter something with which I am unfamiliar, I look it up and learn about it. I also sometimes read though documentation of a library I am using, a few pages a night.

Learn how to be your own teacher.

1 Like

Hi @rtwoods88 !

I added spoiler tags around your code since this is a working solution.


There is no way for freeCodeCamp or any other course to teach every single built in javascript method.
That would be a really, really long course :grinning:

The great thing about these algorithm challenges as well as other practice sites like codewars, leetcode or exercism is that you can explore other methods and get better acquainted with the documentation.

The more challenge that you do the more methods you will research and learn about.

Also, the more projects you build, the more methods you will learn about.

Hope that helps! :grinning:

2 Likes

There are lots of resources but the one I would really highlight is MDN

2 Likes

The solutions that you see on the “hints” are ones that have been submitted by freeCodeCamp community members over the years, so sometimes they will include methods that aren’t explicitly covered by freeCodeCamp. As @kevinSmith pointed out, there are way to many methods to teach each of them. Also, I’d say that there isn’t really value in adding a lesson for every method even if it were possible. Once you get comfortable with how various types of methods work in general, documentation on sites like MDN are enough to understand a new method you’ve never seen before.

In answer to your question of how we know about them, once you get through the fundamentals a lot of being a programmer involves searching for the thing you need when you need it. You get good at optimizing your google search terms and skimming documentation to look for tools that might be useful for a specific goal that you’re trying to accomplish.

3 Likes