I don't see where I am missing the return boolean.
This is what I have for code in helper.js:
export const isIdentical = (arr1, arr2) => {
const obj1Keys = Object.keys(arr1);
const obj2Keys = Object.keys(arr2);
if (obj1Keys.length !== obj2Keys.length) {
return false;
}
for (let i = 0; i < obj1Keys.length; i++) {
if (!obj2Keys.includes(obj1Keys[i])) {
return false;
}
}
return true;
};
Code explanation:
The function takes in two objects as arguments, compares their keys and returns a boolean value indicating whether they have the same keys or not. It uses the Object.keys() method to get an array of the keys of each object, then compares the number of keys, and then check if all the keys of obj1 are also in obj2.
The error that is displayed:
Status
FAILED
Details
- The function isIdentical should return true if the objects are identical and false otherwise