JSFiddle - React, Tailwind, and code Playground
by fairmutex
JavaScript
function deepEqual(a,b){
if(typeof a === 'object' && typeof b === 'object'){
if (a !== null && b !== null){ // of both are not null
var propA = Object.getOwnPropertyNames(a);
var propB = Object.getOwnPropertyNames(b);
if (propA.length == propB.length){
for(i = 0 ; i < propA.length;i++){
if(typeof propA === 'object')
return deepEqual();
}
}
else{
return false;
}
}else{
if (a === b){
return true;
}else{
return false;
}
}
else{
if (a === b){
return true;
}else{
return false;
}
}
if(typeof a === 'object' && typeof b === 'object'){ // if both ae objects
if (a !== null && b !== null){ // of both are not null
var propA = Object.getOwnPropertyNames(a);
var propB = Object.getOwnPropertyNames(b);
}else{
if (a === b){
return true;
}else{
return false;
}
}
}
else{
if (a === b){
return true;
}else{
return false;
}
}
}