var a = {}; a['fruit'] = "apple"; var b = {}; b['vegetable'] = "carrot"; var food = Object.assign({}, a, b); console.log(food);