434-number-of-segments-in-a-string

DevGod
Vtuber
/** * @param {string} s * @return {number} */var countSegments = function(s) { if(s.trim() == ""){ return 0; } return s.trim().split(/\s+/g).length;};
/** * @param {string} s * @return {number} */var countSegments = function(s) { if(s.trim() == ""){ return 0; } return s.trim().split(/\s+/g).length;};