What would be a shorthand for the following:
setupIframeConfig(element: HTMLIFrameElement, config: IFrameConfig){
element.src = config.src;
element.width = config.width;
element.width = config.width;
}
using rest wont do it because it will create a new object instead of the HTML element reference.
element = {...element, ...config}
thought maybe destructured assignmnent, but is used for declaring variables.
whats a shorthand es6/7 for this case?
I'm assuming that you are looking for the least-verbose way of doing this.
Most likely this would be achieved by using
Object.assign:in your case, the target object is
elementand the only source object here would beconfig: