Leetcode - 58. Length of Last Word

/** * @param {string} s * @return {number} */ var lengthOfLastWord = function(s) { let words = s.split(" ").filter((word) => word!=""); return words.pop().length };

Feb 26, 2025 - 17:56
 0
Leetcode - 58. Length of Last Word
/**
 * @param {string} s
 * @return {number}
 */
var lengthOfLastWord = function(s) {
    let words = s.split(" ").filter((word) => word!="");
    return words.pop().length
};