0

Pulling my hair out over this one,

I am trying to get the diff between two objects like this. They are nested objects not arrays:

Object a { innerA={...}, innerB={..}, innerC={...} }
Object b { innerA={...}, innerC={...} }

The difference should be innerB object.

I have use of the jQuery lib (1.7.2).

I would post code but I have tried so much I wouldn't know what to put anymore!

1
  • 1
    jQuery doesn't have anything that will help you here, you'll have to loop through them yourself. Commented Sep 14, 2012 at 17:23

1 Answer 1

4
var a = { innerA:{}, innerB:{}, innerC:{} };
var b = { innerA:{}, innerC:{} };

$.each(a, function(index){
    if(!b[index]) {
        // do what you want
    }
});

demo

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, so simple in the end I was over complicating it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.