Javascript Levenshtein Function