var hammingDistance = function(x, y) { let r = x^y, res = 0 while(r !== 0) { if (r % 2 !== 0) { ++res; } r = parseInt(r / 2) } return res };