Hi!
im doing the exercise for js but in this case my code is working on my computer not in the page :S
function findLongestWordLength(str) {
let i = [...str];
let contador = 0;
let contadorBase = 0;
i.forEach((celda,index) => {
if(celda === " " || index+1 === i.length){
if(contador >= contadorBase){
contadorBase = contador;
contador = 0;
}else{
contador = 0;
}
}else{
contador++;
}
})
return contadorBase;
}
console.log(findLongestWordLength("What if we try a super-long word such as otorhinolaryngology "));
this returned 19 but the freecodecamp’s test fail… i try not to see the “solutions” unless i really don’t know what to do… any idea why this hasn’t passed the test?
link:
