param { string } s return { number } function LengthOfLongestSubstring ( s ) { let sub = '' ; let count = 0 , result = 0 ; for ( let n of s ) { if ( sub . indexOf ( n ) === - 1 ) { sub += n ; count ++ ; result = count > result ? count : result ; } else { sub = sub . slice ( sub . indexOf ( n ) + 1 ) ; sub += n ; count = sub . length ; } } return result ; } export { LengthOfLongestSubstring } ;