curriculum/challenges/english/blocks/daily-coding-challenges-javascript/68b1f72371a5ac895ac70a0a.md
Given two strings, determine if the second string is a mirror of the first.
isMirror("helloworld", "helloworld") should return false.
assert.isFalse(isMirror("helloworld", "helloworld"));
isMirror("Hello World", "dlroW olleH") should return true.
assert.isTrue(isMirror("Hello World", "dlroW olleH"));
isMirror("RaceCar", "raCecaR") should return true.
assert.isTrue(isMirror("RaceCar", "raCecaR"));
isMirror("RaceCar", "RaceCar") should return false.
assert.isFalse(isMirror("RaceCar", "RaceCar"));
isMirror("Mirror", "rorrim") should return false.
assert.isFalse(isMirror("Mirror", "rorrim"));
isMirror("Hello World", "dlroW-olleH") should return true.
assert.isTrue(isMirror("Hello World", "dlroW-olleH"));
isMirror("Hello World", "!dlroW !olleH") should return true.
assert.isTrue(isMirror("Hello World", "!dlroW !olleH"));
function isMirror(str1, str2) {
return str1;
}
function isMirror(str1, str2) {
const clean1 = str1.replace(/[^a-zA-Z]/g, "");
const clean2 = str2.replace(/[^a-zA-Z]/g, "");
return clean1.split("").reverse().join("") === clean2;
}