문제 링크 : Number of Segments in a String
/** * @param {string} s * @return {number} */ var countSegments = function(s) { return s.split(' ').filter(s => s.trim().length).length };