title: Write a JavaScript function to find longest substring in a given a string without repeating characters
body: <p>"Write a JavaScript function to find longest substring in a given a string without repeating characters."</p>
  
  <p>Here's what I tried, but it doesn't print anything</p>
  
  <pre><code>function sort(names) {
    let string = "";
    let namestring = names.split("");
  
    for(let i = 0; i &lt; namestring.length; i++) {
      for(let j = 0; j &lt; string.length; j++) {
        if(string[j] != namestring[i]) {
          string = string + namestring[i];
        } 
      }
    }
  
    return string;
  }
  
  console.log(sort("google.com"));
  </code></pre>
  
  <p>What's wrong?</p>