Longest Substring

Warm-Up

Write a JavaScript function to find the longest substring in a given a string without repeating characters.

Example:

longestSub("happy");
//returns "hap"