GhostDZ9 GhostDZ9 - 6 days ago 5
Javascript Question

Compare Javascript Object Values

I am building an integration and I have two objects. The makeup of the objects is as follows:

var objectA = {};
objectA['alpha'] = 'charlie';

var objectB = {};
objectB['bravo'] = 'charlie;


What I want to know is given the two objects above is it possible to compare the two value to see if they are different?

Please note that the objects make up are completely different for both objects but I just need to compare the values.

Thanks in advance!

Answer

You can do this:

objectA.alpha === objectB.bravo

OR

objectA['alpha'] === objectB['bravo']

Assuming alpha and bravo are not Objects again.

Comments