curriculum/challenges/english/blocks/daily-coding-challenges-javascript/68f6587287ad1f4ad39b0c85.md
Given two strings representing fingerprints, determine if they are a match using the following rules:
a-z).isMatch("helloworld", "helloworld") should return true.
assert.isTrue(isMatch("helloworld", "helloworld"));
isMatch("helloworld", "helloworlds") should return false.
assert.isFalse(isMatch("helloworld", "helloworlds"));
isMatch("helloworld", "jelloworld") should return true.
assert.isTrue(isMatch("helloworld", "jelloworld"));
isMatch("thequickbrownfoxjumpsoverthelazydog", "thequickbrownfoxjumpsoverthelazydog") should return true.
assert.isTrue(isMatch("thequickbrownfoxjumpsoverthelazydog", "thequickbrownfoxjumpsoverthelazydog"));
isMatch("theslickbrownfoxjumpsoverthelazydog", "thequickbrownfoxjumpsoverthehazydog") should return true.
assert.isTrue(isMatch("theslickbrownfoxjumpsoverthelazydog", "thequickbrownfoxjumpsoverthehazydog"));
isMatch("thequickbrownfoxjumpsoverthelazydog", "thequickbrownfoxjumpsoverthehazycat") should return false.
assert.isFalse(isMatch("thequickbrownfoxjumpsoverthelazydog", "thequickbrownfoxjumpsoverthehazycat"));
function isMatch(fingerprintA, fingerprintB) {
return fingerprintA;
}
function isMatch(fingerprintA, fingerprintB) {
if (fingerprintA.length !== fingerprintB.length) return false;
const length = fingerprintA.length;
let mismatches = 0;
for (let i = 0; i < length; i++) {
if (fingerprintA[i] !== fingerprintB[i]) {
mismatches++;
if (mismatches > length * 0.1) return false;
}
}
return true;
}