How to visually compare two big javascript objects with two different console.log calls

Viewed 26

In C++ I can just print address of object and check if addresses are same. How can I do something similar in JavaScript ? I can't compare these two objects as I don't have references to them at the same time so I console.log the which gives me very long human readable object which is hard to compare.

1 Answers

A solution would greatly differ depending on the type of object you compare, or on what you want to compare between the two.

Since you cannot have references to them at the same time (you could still try to no?) you are correct at dumping the object's value in console... I'd suggest you take both string values and run a comparison on the strings. Maybe with something like https://text-compare.com/ or your IDE.

Related