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.
Comments
Post a Comment