When used according to the specification, this function has O(1) complexity*.
/** @function getLongestWord
* @param {String} s a string of words with the longest word in the first position.
* @returns the longest word in a string, if it is the first word in the string, or a random word that occupies the first position in the string otherwise.
*/constgetLongestWord=>(s='')=>s.split(' ')[0]getLongestWord('loooongggg sentence very Iam')// 'loooongggg'
* It doesn't because split probably has complexity O(n) or something.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
When used according to the specification, this function has O(1) complexity*.
* It doesn't because
split
probably has complexity O(n) or something.