I dont want to just look up the answer but im not really sure if im even going in the right direction at the moment, some insight would be appreciated! Thank You!
Your code so far
function findLongestWord(str) {
var Array = str.split(" ");
var arrayLength = Array.length;
for (var i = 0; i < arrayLength; i++) {
if (Array[0] <= Array[1]) {
Array[0].pop();}
else {
if (Array[1] <= Array [0]) {
Array[1].pop();
}
}
}
return str.length;
}
findLongestWord("The quick brown fox jumped over the lazy dog");
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/find-the-longest-word-in-a-string