Hamming Distance in JS