I was looking at codes on stack overflow and I bumped into a problem that included this piece of code:
var obj = {here: 2};
console.log(deepEqual(obj, obj));
// → true
console.log(deepEqual(obj, {here: 1}));
// → false
console.log(deepEqual(obj, {here: 2}));
// → true
console.log(obj === { here:2 });
// → false
I've tried to run this specific piece of code on my text editor, however the console displays:
Uncaught ReferenceError: deepEqual is not defined
And it constantly happens when I use deepEqual on JavaScript, I'm still learning JavaScript, is there a reason as to why this is happening ? Isn't deepEqual supposed to be a JavaScript method ? Therefore able to run without being defined ? Thanks in advance !