Homepage
Sign in / Sign up
Go to the profile of Slava Ganzin
Slava Ganzin
Apr 4, 2016
Three Ways to Find the Longest Word in a String in JavaScript
Sonya Moisset
13422

Sometimes it better to read docs first, everything was done before:
“22 1 333 666666 55555 4444”.match(/\w+/g).sort().reverse()[0].length
P.S. split(‘ ’) is naive besides

  • Go to the profile of Slava Ganzin

    Slava Ganzin

    • Share
    Go to the profile of Slava Ganzin
    Never miss a story from Slava Ganzin, when you sign up for Medium. Learn more
    Never miss a story from Slava Ganzin