const obj1 = {
  a: "old value",
  b: {
    c: "old value"
  },
  d: 123
}
const obj2 = {
  a: "old value",
  b: {
    c: "new value"
  },
  d: 321
}
const changes =
  _.differenceWith(_.toPairs(obj2), _.toPairs(obj1), _.isEqual)

// Changes in array form
console.log(changes)
// Changes in object form
console.log(_.fromPairs(changes))
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>

Answer from Dani on Stack Overflow
🌐
Lodash
lodash.com › docs
Lodash Documentation
This method is like _.difference except that it accepts iteratee which is invoked for each element of array and values to generate the criterion by which they're compared. The order and references of result values are determined by the first array. The iteratee is invoked with one argument: (value).
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › lodash-_-difference-function
Lodash _.difference() Function - GeeksforGeeks
July 15, 2025 - Lodash _.difference() function is used to remove a single element or the array of elements from the original array. This function works pretty much the same as the core function of JavaScript i.e.
🌐
npm
npmjs.com › package › lodash.difference
lodash.difference - npm
August 13, 2016 - The lodash method `_.difference` exported as a module.. Latest version: 4.5.0, last published: 10 years ago. Start using lodash.difference in your project by running `npm i lodash.difference`. There are 487 other projects in the npm registry using lodash.difference.
      » npm install lodash.difference
    
Published   Aug 13, 2016
Version   4.5.0
Author   John-David Dalton
🌐
Medium
medium.com › @thecodeduck › learn-by-doing-lodash-difference-a24216b54e09
Learn by Doing Lodash _.difference | by thecodeduck | Medium
November 12, 2018 - Learn by Doing Lodash _.difference _.difference(array, [values]) Creates an array of array values not included in the other given arrays using SameValueZero for equality comparisons. The order and …
🌐
GitHub
github.com › lodash › lodash › issues › 1867
Difference of sets (array of objects) · Issue #1867 · lodash/lodash
January 23, 2016 - I have two array of objects, like below: collection one: [{ "sku": "33220", "barcode": "", "name": "Lenovo S930 Dual SIM Mobile Phone" }, { "sku": "TN2A", "price": 73000000.0, "barcode": "8412544031648", "name": "BOTELLA TRITAN BLUE 0.75...
Author   al3rez
🌐
TutorialsPoint
tutorialspoint.com › lodash › lodash_difference.htm
Lodash - difference method
Lodash - Discussion · Selected ... · _.difference(array, [values]) Creates an array of array values not included in the other given arrays using SameValueZero for equality comparisons....
Find elsewhere
🌐
Dustin John Pfister
dustinpfister.github.io › 2019 › 03 › 27 › lodash_difference
lodash difference method examples | Dustin John Pfister at github pages
January 14, 2022 - So then as the name implies, it is a way to go about extracting the difference from an array, using one or more additional arrays as a way to known what to extract. The comparisons are made in compliance with the Same Value Zero standard that ...
🌐
GitHub
gist.github.com › Yimiprod › 7ee176597fef230d1451
Deep diff between two object, using lodash · GitHub
/** * Recursive diff between two object * @param {Object} base Object to compare with * @param {Object} object Object compared * @return {Object} Return a new object who represent the diff OR Return FALSE if there is no difference */ function differenceBetweenObjects (base,object){ let diff = false; if(typeof object == 'object'){ for(let k in object){ if(typeof object[k] != 'object'){ if(base[k] != object[k]){ if(diff == false){diff = {};} diff[k] = object[k]; } } else{ let subDiff = differenceBetweenObjects(base[k],object[k]); if(subDiff !== false){ if(diff == false){diff = {};} diff[k] = subDiff; } } } } if(typeof base == 'object'){ for(let k in base){ if(!object.hasOwnProperty(k)){ diff[k] = null; } } } return diff; }
🌐
npm
npmjs.com › package › @types › lodash.difference
@types/lodash.difference - npm
November 7, 2023 - // Generated from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/lodash/scripts/generate-modules.ts import { difference } from "lodash"; export = difference;
      » npm install @types/lodash.difference
    
🌐
Mastering JS
masteringjs.io › tutorials › lodash › difference
The difference() function in Lodash
April 12, 2022 - Bite-sized full stack JavaScript tutorials for pragmatic developers that get things done
🌐
DreamFactory Forum
community.dreamfactory.com › server-side scripting
Lodash. vs _. difference - Server-Side Scripting - DreamFactory Forum
March 20, 2016 - I am trimming an array this way using lodash var data_parts = lodash._.map(strData.split("|"), lodash._.trim); but I don't see the lodash. prefix in most examples that I see on websites. They almost all just use _.ma…
🌐
Lodash
lodash.info › doc › difference
difference - Lodash documentation
Documentation and examples for Lodash method difference
🌐
GitHub
github.com › lodash › lodash
lodash v4.17.23
A modern JavaScript utility library delivering modularity, performance, & extras. - lodash/lodash
Starred by 61.6K users
Forked by 7.1K users
Languages   JavaScript 97.2% | HTML 2.3% | EJS 0.5%
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › lodash-_-differencewith-method
Lodash _.differenceWith() Method - GeeksforGeeks
July 12, 2025 - Example 2: In this example, we are finding the difference of the arrays by using the lodash _.differenceWith() method.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Set › difference
Set.prototype.difference() - JavaScript | MDN
July 10, 2025 - difference() accepts set-like objects as the other parameter. It requires this to be an actual Set instance, because it directly retrieves the underlying data stored in this without invoking any user code.
🌐
Lodash
lodash.com
Lodash
Lodash makes JavaScript easier by taking the hassle out of working with arrays, numbers, objects, strings, etc.
🌐
npm Trends
npmtrends.com › lodash.difference-vs-lodash.differencewith-vs-lodash.get-vs-object-path
lodash.difference vs lodash.differencewith vs lodash.get vs object-path | npm trends
Comparing trends for lodash.difference 4.5.0 which has 7,272,702 weekly downloads and 61,493 GitHub stars vs. lodash.differencewith 4.5.0 which has 116,646 weekly downloads and 61,493 GitHub stars vs. lodash.get 4.4.2 which has 14,135,289 weekly downloads and 61,493 GitHub stars vs. object-path 0.11.8 which has 1,848,299 weekly downloads and 1,066 GitHub stars.