solved Task 2
This commit is contained in:
parent
b5aca0b708
commit
d0e69401e0
|
@ -0,0 +1,28 @@
|
|||
const { type } = require("os");
|
||||
|
||||
const equal = function(obj1, obj2) {
|
||||
|
||||
if(obj1 === obj2){
|
||||
return true;
|
||||
} else if(typeof(obj1) !== 'object' || typeof(obj2) !== 'object') {
|
||||
return false
|
||||
}
|
||||
else {
|
||||
let Isequal = true;
|
||||
for (const [key, value] of Object.entries(obj1)) {
|
||||
if(value !== obj2[key]) {
|
||||
console.log(key, value, obj2[key])
|
||||
return false
|
||||
}
|
||||
}
|
||||
for (const [key, value] of Object.entries(obj2)) {
|
||||
if(value !== obj1[key]) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
module.exports = { equal }
|
Loading…
Reference in New Issue