Java Script summer weekend day № 1: Finding the largest word
Task: Finding the largest word in a string
Java Script code:
let text = " The store is around the corner "
let splitText = text.split(" ")
let longestWord = "";
for (let i = 0; i < splitText.length; i++) {
if (splitText[i].length > longestWord.length) {
longestWord = splitText[i];
}
}
console.log(longestWord)
Result: