Compare 2 objects and get differences
Compare 2 objects and get differences
by Nirvanachain
HTML
<script src="https://rawgithub.com/lodash/lodash/3.7.0/lodash.js"></script>
JavaScript
var obj1 = {
"name": "Joe",
"color": "blue",
"fan": false
};
var obj2 = {
"name": "Joe",
"color": "red",
"fan": true
};
var compare = _.omit(obj2, function(value, key) {
return obj1[key] === value;
});
console.log(compare);