Created
September 3, 2023 11:04
-
-
Save ChousinRahit/1886037cfdd547de7538240ddb4b1527 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Longest Word | |
// Write a function that finds the longest word in a sentence and returns it. | |
// If two or more words are the biggest, return the word closest to the start of the sentence. | |
// Characters such as apostrophe, commas, periods, etc count as letters (e.g.O'Connor is 8 characters long). | |
// Examples | |
// longestWord("Hello darkness my old friend") ➞ "darkness" | |
// longestWord("Hello there mate") ➞ "Hello" | |
// longestWord("Kayla's toy is plastic") ➞ "Kayla's" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment