Find the Longest Word in a String - Basic Algorithm Scripting - Free Code Camp

preview_player
Показать описание
In this basic algorithm scripting tutorial we find the longest word in a string. This is another tutorial that makes up a series where I cover the FreeCodeCamp curriculum. Enjoy!
Рекомендации по теме
Комментарии
Автор

My man is doing gods work here, thanks for the informational break downs!

jeromedre
Автор

Thanks Hawkeye, you helped defeat Thanos and now you helping us defeat JS.

sjeasley
Автор

I feel like i write the first variable and a for loop then get stuck on all these problems XD I greatly appreciate you breaking things down as you do. Hopefully by the end of these modules i won't need you so much but thanks again for being here!

saramoko
Автор

Dude you have a gift of explaining!!!! Need to be on Ted Talk! Thank you!

MrNate
Автор

okay, this set of problems were super hard! thanks for your explanation as always

aaaamontenegro
Автор

This channel was here this whole time and no one tells me? Rude haha Great work man!

callmeFernie
Автор

This has become one of my favorite videos and freecodecamp tutorial becase of you . Your explanation at the end of the video is just gem in the ocean. Thanks!

nikusha
Автор

Also Mr. Ian your answer works as well so its good to know that we can perform two different codes and get the correct answers
function findLongestWordLength(str) {
let longestWord = "";
let words = str.split(" ");
console.log(words);

for (let i = 0; i < words.length; i += 1) {
let individualWord = words[i];
if (individualWord.length > longestWord.length) {
longestWord = individualWord;
}
}


return longestWord.length;
}


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

zken
Автор

That was really helpful, thanks a lot.

selimyay
Автор

loving these logic breakdowns their so helpful :D

nhiemtran
Автор

I came here to submit my assignment ...Great Lecture!

Kranthi_travel_lover
Автор

Really really useful videos. Thank you for your time and effort!!

lih
Автор

You just made my day, bro, that k you so much.

heinhtet
Автор

function findLongestWordLength(str) {
let arr = [];
let words = str.split(' ');
for(let i = 0; i < words.length; i++){
arr.push(words[i].length);
}
return Math.max(...arr);
}

elbfvnq
Автор

This lesson has been changed and or updated Mr. Ian to a more simple solution and here it is down below sir.
function findLongestWordLength(str) {
return Math.max(...str
.split(" ")
.map(text => text.length))
}
findLongestWordLength("The quick brown fox jumped over the lazy dog");

zken
Автор

I couldnt of thought about all this frankly speaking, although Ive come this far covering all the basics idk why im unable to do it or think through the steps like you did. what do you think of this?

kieran
Автор

I’m not necessarily sure what to do. I’ve been doing the JavaScript course and feel like I’m learning but then I can’t actually apply it or use the material I “learned”

MikeDue
Автор

Great explanation! What is the browser extension you use to auto-suggest words in your text?

json_n
Автор

is it possible to solve intermediate algo... with this knowledge broh ?

cookie-dir-
Автор

Love these videos, but is there a better way of figuring out how to solve these problems? I know you're supposed to try and solve them on your own, but I haven't been able to solve one of these Algorithms so far.

jasongonzales