Length of Last Word
- javascript
- strings
Problem URL:Length of Last Word
My Solution
JavaScript
/**
* @param {string} s
* @return {number}
*/
const lengthOfLastWord = (s) => {
return s
.split(" ")
.filter((str) => str.length > 0)
.pop().length;
};
Let's Connect
Twitter •GitHub •LinkedIn