How to set multiple attributes on the same element

If you only use setAttribute for styling, you could fix it like this:

function setAttribute(element, key, value) {
    element.style[key] = value
}

setAttribute(document.body, "backgroundColor", "red")

Note that you need to use the javascript version of styling (backgroundColor instead of background-color).