Skip to content

Instantly share code, notes, and snippets.

@EmmanuelBeziat
Created March 24, 2019 02:01
Show Gist options
  • Save EmmanuelBeziat/ca7167227e8c111a11dc6acc3f52eede to your computer and use it in GitHub Desktop.
Save EmmanuelBeziat/ca7167227e8c111a11dc6acc3f52eede to your computer and use it in GitHub Desktop.
Return differences between javascript objects's parameters' values
function compare (object1, object2) {
let result = []
Object.keys(object1).forEach(key => {
if (object1[key] !== object2[key]) {
result.push(object2[key])
}
})
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment