const data = {
name : "teahyung",
fatherName : "kim-ji-hyung",
age : 26
}
const data1 = {
name : "jangkook",
fatherName : "kim-ji-hyung",
age : 23
}
ans = {
name : {
old : "teahyung",
new : "jangkook"
},
age : {
old : 26,
new : 23
}
}
Question posted in Javascript
A very good W3school tutorial can be found here.
A very good W3school tutorial can be found here.
2
Answers
This function takes data and data1 objects and returns the differences between these two objects as an object named ans. The function checks each key in the data object and if the values in data and data1 are different, it adds the old and new values for that key to the ans object.
You should create a function that takes the
original
andupdated
objects.This function will:
Here is a more functional approach: