Write and export as default a function returns the length of the last word of an input string. Word is any sequence of characters without gaps (spaces).
import getLastWordLength from './solution.js'; getLastWordLength(''); // 0 getLastWordLength('man in BlacK'); // 5 getLastWordLength('hello, world! '); // 6
- To remove extra spaces use trim method
For full access to the challenge you need a professional subscription.
A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.