Simple Javascript Code
Currently, migrating my c++ code to Javascript code.\n\n\n    var lengthOfLongestSubstring = function(s) {\n      var start = 0, maxLen = 0;\n      var map = ne
Currently, migrating my c++ code to Javascript code.\n\n\n    var lengthOfLongestSubstring = function(s) {\n      var start = 0, maxLen = 0;\n      var map = new Map();\n    \n      for(var i = 0; i < s.length; i++) {\n          var ch = s[i];\n        \n          if(map.get(ch) >= start) start = map.get(ch) + 1;\n          map.set(ch, i);\n        \n          if(i - start + 1 > maxLen) maxLen = i - start + 1;\n      }\n    \n      return maxLen;\n    };
[]