String Distance using JavaScript, my own algorithm!