GhostDZ9 GhostDZ9 - 1 year ago 136
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 Source

You can do this:

objectA.alpha === objectB.bravo


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

Assuming alpha and bravo are not Objects again.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download