If you're seeing this message, it means we're having trouble loading external resources on our website.
If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.
To log in and use all the features of Khan Academy, please enable JavaScript in your browser.
longestWord
["superhero", "captain", "marvel"]
"superhero"
PROCEDURE longestWord(words) { maxWordLen ← 0 maxWord ← "" FOR word IN words { IF (LENGTH(word) > maxWordLen) { maxWord ← word maxWordLen ← LENGTH(word) RETURN maxWord } } RETURN maxWord }
longestWord()
longestWord(["frog", "princess", "alligator"])
longestWord(["landscape", "sky", "flower"])
longestWord(["bumblebee", "cat", "bird"])
longestWord(["crown", "diamond", "castle"])