동일한 길이를 가지는 두 문자열이 있을 때, 한 문자열을 다른 한 문자열로 변환하는데 필요한 최소한의 작업 횟수
const HammingDistance = (str1, str2) => {
if (typeof str1 !== "string" || typeof str2 !== "string") {
throw new Error("Attributes must be string!");
}
if (str1.length !== str2.length) {
throw new Error("Attributes must have same length!");
}
let counter = 0;
Array.from(str1).forEach((char, index) => {
if (char !== str2[index]) {
counter++;
}
});
return counter;
};