{"ScriptPreparationCode":"function hammingDistance(stringA, stringB) {\r\n if (stringA.length === stringB.length) {\r\n let count = 0\r\n for (char in stringA){\r\n if (stringA[char] !== stringB[char]) count\u002B\u002B\r\n }\r\n return count\r\n } else {\r\n return \u0027strings are not the same length\u0027\r\n }\r\n}\r\n\r\nfunction hammingDistanceForLoop(stringA, stringB) {\r\n let result = 0\r\n\r\n if (stringA.length == stringB.length) {\r\n\r\n for (let i = 0; i \u003C stringA.length; i\u002B\u002B) {\r\n if (stringA[i].toLowerCase() != stringB[i].toLowerCase()) {\r\n result\u002B\u002B\r\n }\r\n }\r\n return result\r\n } else {\r\n throw new Error(\u0027Strings do not have equal length\u0027)\r\n }\r\n}","TestCases":[{"Name":"For In","Code":"hammingDistance(\u0027riverotter\u0027, \u0027roderofter\u0027)","IsDeferred":false},{"Name":"For Loop","Code":"hammingDistanceForLoop(\u0027riverotter\u0027, \u0027roderofter\u0027)","IsDeferred":false}]}