✔️ 100% Fastest TypeScript Solution
\nfunction lengthOfLongestSubstring(s: string): number {\n  const scanner: string[] = []\n  let longest = 0\n\n  for (const char of s) {\n    const possibleInde
```\nfunction lengthOfLongestSubstring(s: string): number {\n  const scanner: string[] = []\n  let longest = 0\n\n  for (const char of s) {\n    const possibleIndex = scanner.indexOf(char)\n\n    if (possibleIndex !== -1) { scanner.splice(0, possibleIndex + 1) }\n    scanner.push(char)\n    longest = Math.max(longest, scanner.length)\n  }\n\n  return longest\n}\n```\n\nLet me know in comments if you have any doubts. I will be happy to answer.\n\nPlease upvote if you found the solution useful.
['TypeScript', 'JavaScript']