Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

find biggest word in the string

function findLongestWordLength(str) {
  let words = str.split(' ');
  let maxLength = 0;

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

  return maxLength;
}
Source by forum.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #find #biggest #word #string
ADD COMMENT
Topic
Name
3+5 =