Last active
September 20, 2023 22:29
-
-
Save Restoration/b1136471015a895011ecf1886bcfd509 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mergeObjects(objA, objB) { | |
const keys = new Set([...Object.keys(objA), ...Object.keys(objB)]); | |
const result = {}; | |
keys.forEach(key => { | |
result[key] = objB[key] !== undefined ? objB[key] : objA[key]; | |
}); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment