How to add two Objects in objects items

Recently, I’ve asked a question about how to create a shortand for addEventListener, the result was:

var dom = {
  id: function(elementId) {
    var element = document.getElementById(elementId);
    return Object.create(element, {
      on: {
        value(event, fn, options) {
          element.addEventListener(event, fn, options);
        }
      }
    })
  }
};

what if I wanted to add two Object.create? How would I return it? Is it even possible?

46 thoughts on “How to add two Objects in objects items”

Leave a Comment