@anonymous/

IntelligentPrevailingField

JavaScript

No description

fork
loading
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function findLongestWord(str) {
  var wordbank = str.split(" ");
  //console.log(str);
  //console.log(wordbank);
  var max = 0;
  for (var i = 0; i < str.length; i++ ) {
    console.log(i);
    if (wordbank[i].length > max) {
      max = wordbank[i].length;
    }
  }
  return max;
}

findLongestWord("What if we try a super-long word such as otorhinolaryngology");
Native Browser JavaScript