I have a javascript object which can be updated or patched and i want to be able to know by comparing the original which is object p and object p2 which is a copy of object p to know which elements were updated. So in this case i want to be able to compare the two to know if there has been some difference if so, then i grab the id's of the changed ones into a something like; edited = [1, 3].
This is the main object.
var p = {
"1": "value1",
"2": "value2",
"3": "value3"
};
Let's say it has been copied and updated to:
var p2 = {
"1": "changed",
"2": "value2",
"3": "changed"
};