Created
January 6, 2023 18:38
-
-
Save leodevbro/410e02011f603af964baf700a286e583 to your computer and use it in GitHub Desktop.
Special Task Solution
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
// more readable and maintainable (I converted it to TypeScript) | |
const makeLowerCaseAndfindLongWordsInReverseOrder = (text: string) => { | |
const lowerCased = text.toLocaleLowerCase(); | |
const words = lowerCased.split(" "); | |
words.reverse(); | |
const trimmedWords = words.map((w) => w.trim()); | |
const longWords = trimmedWords.filter((w) => w.length > 5); | |
const result = longWords.join(", "); | |
return result; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/omesser/508871b98398759488337fa39f81c778#file-prettify-js