Generation

generate functionMon, 28 Nov 2022

Define a word as a sequence of consecutive English letters. Find the longest word from the given string.

const myString = 'Find the longest word from the given string.' const myStringArr = myString.split(' ') function longestWord(myStringArr) { let longestWord = '' for (let word of myStringArr) { if (word.length > longestWord.length) { longestWord = word } } return longestWord }

TypeScript
Generate More

Want to kickstart your project?Use the new AI Studio to create your code