One thing to be careful about in JavaScript is the difference between == and ===

“==” and “===”

In JavaScript, the operator “==” tries to do type coercion between two variables which converts a string to a number so that you can compare a number and a string as shown below

console.log(5 == "5"); // true   , TS Error
console.log(5 === "5"); // false , TS Error

The operatr “===” won’t convert types. It will check types at both sides strictly.

Similar to “==” vs. “===”, there is “!=” vs. “!==” problem.

So, always use “===” and “!==” except for null checks

Structural Equality - deep equal

compare two objects for structural equality, == / === are not sufficient

console.log({a:123} == {a:123}); // False
console.log({a:123} === {a:123}); // False

Use deep-equal npm package

import * as deepEqual from "deep-equal";

console.log(deepEqual({a:123},{a:123})); // True