SO 23186187
Response to http://stackoverflow.com/questions/23186187/merge-two-javascript-objects-if-key-is-equal-with-either-lodash-vanilla-js-or
HTML
<pre class="result"></pre>
JavaScript
const city = "Denver";
const gdp = {
"city": city,
"gdp": [],
};
const income = {
"city": city,
"income": [],
};
const uRate = {
"city": city,
"uRate": [],
};
// Merge the objects
const merged = Object.assign({}, gdp, income, uRate);
// Output the result
document.querySelector('.result').textContent = JSON.stringify(merged, null, 2);