/**
* @param {string} s
* @return {number}
*/
var lengthOfLastWord = function(s) {
var arr = s.trim().split(' ')
return arr[arr.length - 1].length
};
faster than 100%
var lengthOfLastWord = function(s) {
return s
.trim()
.split(' ')
.splice(-1)
.toString()
.split('')
.length;
};