javascript - How to compare two objects -


I have a scenario where I have two different objects.

To get the scenario:

Two objects need to match values ​​like "A1", "B2", etc. ...

Since the two object values ​​are not in the proper order, the loop is breaking and some values ​​are missing.

In my demo, Object 1 has the same repeated value i.e. "C3", it should only be displayed once.

The required final output is to find out just matching the value from two objects and display its "A" and "B value".

I have tried about 90%, but some small disturbance is breaking my loop, please help me.

Sample code:

 for  (var i = 0; i & lt; obj1.results [0] .loc.length; i ++) {var findA = Obj1.results [0] .loc [i] .ac [0] .title; For (var j = 0; j & lt; obj2.iloc.length; j ++) {var findb = obj2.ILoc [j] .ais; If (findA == findB) {var a = obj1.results [0] .loc [i] .a; Var b = obj1.results [0] .loc [i] .b; Console.log (a); Console.log (b); }}}  

This is what I tried:

I I recommend using loops because you are using objects instead of orange.

{variable} {...}

If the length is equal to the property of both objects, then this kind of loop will easily compare you to objects Will help.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -