I am new into JavaScript and I have few questions please. First, I am going through two objects to compute the difference between them. So, I have my loop and bunch of if statement for testing. What I am doing is if I find the element I am looking for, I need to add it to a new object while my object is a key and value. The format is like this:
obj={programValue[i] : deviceValue[i]}
I do it like that because I want this format : obj={'p1': 'app1'}
This result an error, how can I add an element in my object?
My second question is how can I go through an objects that contains other objects itself and test the existence of a key or a value of another objects that contains objects as well.
Here is an example to explain:
var obj1={{'p1':'app1'}, {'p2':'app2'}};
var obj2= {{'p1':'app2'}, {'p1':'app1'}}
So I want to test if app2
from obj1 exists in obj2, if so then test the key too. What I need is that they have some value (app) but different keys (p1 or p2).
I tried many things but didn't fulfill what I need.
Thank you,