# Was "Basic Algorithm Scripting" rearranged in the Curriculum?

I’m refreshing my Javascript knowledge by going through all the JS curriculum. Currently, I’m in “Find the Longest Word in a String” that’s under “Basic Algorithm Scripting” section. I know that I can easily solve this with `.split()` method. However, I haven’t came across this `.split()` method yet before encountering this “Find the longest word” problem. Since I was acting like I’m a new programmer, I managed to write this solution with what I’ve learned so far.

``````function findLongestWordLength(str) {
let count = 0;
let arr = [];
let wordCount = "";

for (let i = 0; i < str.length; i++) {
if(str[i] !== " ") {
wordCount += str[i];
} else {
if(wordCount.length >= count) {
count = wordCount.length;
}
wordCount = "";
}
}
if(wordCount !== "") {
if(wordCount.length >= count) {
count = wordCount.length;
}
}
return count;
}

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

When I inspected the “Get an Hint” link, this guide’s (freeCodeCamp Challenge Guide: Find the Longest Word in a String) solutions all included the `.split` method that wasn’t covered yet. It would be confusing to any new students.

I recommend that you or FCC either update this guide or add this .split() info before the “Basic Algorithm Scripting” section.

Hei that’s strange. Did the course some time ago and clearly remembered that they talked about the `.split()` method.

Don’t know if Functional Programming was moved around but now it’s clearly here. So you’d had to also do OOP before reaching it. Might really be confusing for some Exactly, it looks like “Functional Programming” section was placed after “Basic Algorithm Scripting”. Normally, people will move down from top while learning Javascript. Therefore, if they came across this problem without doing “Functional Programming”, they would be confused.

How do one contact FCC about that?

There are a variety of solutions in the guide. Some of the guide solutions use more advanced techniques that have not yet been covered at that point in the curriculum, but every challenge can be solved with the material covered in the course so far.

Right. However, for new programmers who’s struggling to understand this problem and then went to this Guide to look at solutions would see the split().method that hasn’t been covered yet. They would be confused at this point realizing that they haven’t came across that yet.

I’m just pointing this problem out from the view of new programmers.

1 Like

I don’t really see this as a problem. The suggested solutions in the guide are just there to provide alternatives after the user has solved the problem.

Actually i am a biginner and tried it as given below.

function findLongestWordLength(str) {

let arr=[ ];

for(let i=0; i<=str.length; i++){

``````let a="";

for(let j=i; j<=str.length;j++){
``````

if(str[j]!==" " && j!==str.length){

a=a+str[j];

}

else{

arr.push(a.length);

i=j;

break;

}

``````}
``````

}

let m;

let n;

for(let x=0; x<arr.length;x++){

``````if(arr[x]>arr[x+1]){

m=arr[x];

n=arr[x+1];

arr[x]=n;

arr[x+1]=m;

}
``````

}

return arr[arr.length-1];

}

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