Fast(>98%) and simple code in Javascript solution
javascript\nvar lengthOfLongestSubstring = function(s) {\n  var sLen = s.length,\n    maxLen = 0,\n    maxStr = '',\n    tmpStr,\n    posIndex,\n    i;\n\n  for
```javascript\nvar lengthOfLongestSubstring = function(s) {\n  var sLen = s.length,\n    maxLen = 0,\n    maxStr = '',\n    tmpStr,\n    posIndex,\n    i;\n\n  for( i = 0 ; i < sLen; i++ ){\n\n    tmpStr = s[i];\n    posIndex = maxStr.indexOf(tmpStr);\n\n    if(posIndex > -1){\n      maxStr = maxStr.substring(posIndex + 1);\n    }\n\n    maxStr += tmpStr;\n    maxLen = Math.max(maxLen, maxStr.length);\n  }\n\n  return maxLen;\n};\n```
['JavaScript']