I want to replace objectB key from objectA value. and before that swap,objectA and ObjectB key should be matching in each object. then return data in objectC.
i saw this thread, but i just want matching key before swapping key and value. Swap key with value JSON
like this
var objA ={100:'new',200:'in progress',300:'done',500:'exception',225:'critical'};
var objB ={100:12,200:5,300:50};
objectA and objectB are having same key.
objectA key is statusID,and value is like Display statusID name for user.
objectB key is statusID,and value is statusID count.so this count value is sample.
so first,I want objectA and objectB key matching.this time, 100,200,300 are same keys.
and if they are matching,matched objectA key's value replacing objectB key. like, key 100 is matched,objectB key 100 should turn to 'new'. then finally,objectC result should be like this.
var objC ={'new':12,'in progress':5,'done':50};
any suggestion are welcome. thanks for read.