Basic Algorithm Scripting - Parameters never been covered before, yet still expected to know them?

Tell us what’s happening:
Do I remember correctly by saying this was never covered in the previous challenges?
Previously I had to use .split and .reverse and .join, these were also never covered before but for some reason I am expected to know them, which kind of drags me down and really makes me worry if I ever manage to master Javascript since things are quickly becoming extremely difficult and parameters are added in which I’ve never seen before.

So far in basic algorithm scripting except for the first assignment I’ve been looking up the answer and copy pasting that one and trying to comprehend what is going on while I’d be much happier if I could just recognize what is needed to solve the challenge by myself, if that makes sense. Can anyone for example in this challenge like describe their line of thought on how they’d try solve the challenge? Perhaps it helps me in further challenges. I know about .length parameters, but if i remember correctly I’ve never even touched upon how we can JS automatically find the longest word in a string.

Also, I am having extreme difficulty understanding all of the hundreds of parameters that make up javascript and knowing when to use which. Does anyone know a good cheat sheet where I can directly know what to use in a certain situation or where to do small test assignments in between FCC challenges or how to better understand complex formulas? I am suffering from dyscalculia so some of these mathmetics formula’s are really giving me a hard time. Easy formulas and functions are good enough, but I do understand I have to eventually know how to learn advanced functions and formulas.

Your code so far

function findLongestWordLength(str) {
  return str.length;

findLongestWordLength("The quick brown fox jumped over the lazy dog");

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:107.0) Gecko/20100101 Firefox/107.0

Challenge: Basic Algorithm Scripting - Find the Longest Word in a String

Link to the challenge:

Hi there,

A few things: it isn’t a good idea to look up answers. What will happen is what is happening to you now–you skip some basic knowledge and now are too far in and do not have the knowledge base to complete the assignments. It’s just going to get harder from here. You should really go back to the beginning and try again, reading every single challenge carefully and trying until you can complete it. If you DO have to look up the answer, you should read it over and over until you understand it and can implement it another way (not just copy/paste). You should need at most only a single line from the answer to complete the challenge.

Regarding the functions (.split, etc.)–you’re just going to have to learn them. You can do it over time. Not only does javascript have its own library, but you’ll need to learn even more from the libraries or packages that you download.

The good news is that you don’t have to memorize them! As long as you remember that they are there, you can google them to look up what they accept and what they return. I still do this all the time, even for some common ones.

To solve THIS particular challenge, you need to thing about the steps to execute the request.

  1. You have a string, with a bunch of words separated by spaces.
  2. You need to find the longest word in the bunch.
  3. Someone you have to count the length of each word.
  4. How can you separate the words to make counting them easier?
  5. Once you have counted them, how do I keep track of which word was the longest?
  6. Once I have identified the longest, how do I give back the answer?

Those are the six questions you need to answer to solve this one.

Good luck! Happy to help more if you have any other questions.

Jet because you see a solution with those doesn’t mean you need to use them.

Do not do this! Reading code is a completely different skill than writing code!!! Both are important, but reading code won’t teach you how to write code.

It doesn’t really work well that way. You need to try to develop your own line of thought and work through it. We can help with that.

Don’t worry amouth them. 98% of the time, you only need functions, variables, if, while, and for to solve a problem.

Hello everyone,
I’m having kind of the same issue described above:

When I entered this section, I was under the impression that I would be guided through the process of building the algorithms to solve the challenges (like in previous challenges) but in fact I am just given the problem expecting to solve it on my own.

This particular challenge I have no clue how to solve it and I have the question what is being expected from me at this point:

  • Look for the solution on FCC help section?
  • Google the way to solve it?
  • Break my head until I can come up with a solution?

I’ve seen some other of the headings following this challenge and I know for sure I will not be able to solve them.

This is the second time I go over the previous sections of this certification and I’ve performed better than the first time (except for the regular expressions section, that one still got me hahaha).

Any help, advise?

please create your own topic to discuss your concerns.

Ok. I thought it was not necessary.

You aren’t alone! The forum is here so you can ask questions and get help!

This stuff is hard, but the only way to learn how to problem solve is my actually trying to solve problems.

Hey! Thanks for getting back to me. The truth is I do understand the solutions once I read them a couple of times. The issue is just that I find it really hard to know what is expected of me during a challenge. I read the description. I read the code, and often I just think like ‘ok, now what?’. I often have a hard time imagining what those particular lines of code are used for since in some of the hard challenges there isn’t a lot of comment guidance. Although I keep practicing I keep forgetting the differences between functions such as slice and splice and I’m having a hard time to recognize which function to use during which place during a specific problem. Especially there were one or two challenges where splice slice and map were all added in one line and there you lost me. I just didn’t know where to add all of the () parameters anymore.

Perhaps it is because new Responsive Web Design was project based and I found that a lot easier to work with since it is the same project for 100 challenges and each challenge adds a new ingredient to the cake so to speak. Now things are already laid out for me. I’m more of a learner by doing if that makes sense

For instance, Object oriented programming went like a breeze. I understood every single thing, had no issues whatsoever and I found it really fun to do! Now I’m at Functional Programming and I just wanna smash my head on the table because I have no clue what is going on.

Sure, but understanding somebody else’s code is a different skill that writing your own code.

You ask questions. Its perfectly normal to not know what to do next. The forum is here so you can ask questions. That’s what professional programmers do.

It isn’t really about finding the right lines of code. You come up with a logical process and then find the code to express that process.

I don’t bother memorizing that sort of thing - that’s what Google is for.

Again, it isn’t so much a matter of knowing what syntax will fix the problem for you. That’s not the point. You can solve these with simpler syntax like if and for. The task is to have a logical process to accomplish the task and then describe that process in code.

That’s why you shouldn’t read the answers before you write a solution.

JavaScript (or any programming language) is hard. Ask questions on every single challenge if you need. That’s what we are here for.

I have been a self-taught programmer since I started with C# in 2010 (trying to make games for Xbox Indie Arcade). FreeCodeCamp is maybe the MOST straightfoward programming instruction I’ve ever seen, but nothing has ever taught EVERYTHING once you get into doing your own projects. No book can cover everything.

I have found that googling and reading library docs has been at LEAST fifty percent of my coding learning since I started on this journey (and it’s been even more in the last year, when I quit my job to pursue programming as a career).

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