DEV Community

Discussion on: code every with me

Collapse
 
sherifhegazy profile image
sherifhegazy

// there is no need for the second trim

var lengthOfLastWord = function(s) {
s = s.trim().split(' ');

return (s[s.length-1].length);

};

Collapse
 
coderduck profile image
duccanhole

oh, I didn't notice that. Thanks !