I have been trying to check the value and type of NaN for equality but I am getting errors every time. It seems like there must be a simpler solution. Here are four possible solutions I have tried so far that do not work. Another thing is that the underscore in the first solution is not recognized on edabit or codepen:
solution 1
function checkEquality(a, b) {
if((typeof a === typeof b) ||
(_.isNaN(a) === true) &&
(_.isNaN(b) === true)) {
return true;
}
}
solution 2
function checkEquality(a, b) {
let divisionByZod = 42 / "General Zod";
let valueIsNaN = (divisionByZod !== divisionByZod);
if((typeof a === typeof b) || (42 / 'General Zod' === true)) {
return true;
}
}
solution 3
function checkEquality(a, b) {
if(((typeof a === typeof b) || (isNaN(parseInt(NaN))))) {
return true;
}
}
solution 4
function checkEquality(a, b) {
let c = NaN;
if(((typeof a !== typeof b) || (isNaN(parseInt(c) !== NaN)))) {
return false;
}
}