JSFiddle - React, Tailwind, and code Playground

HTML

<div id="ejemplo_1"></div>
<div id="ejemplo_2"></div>
<div id="ejemplo_3"></div>

JavaScript

var estilo1 = {
    height: '70px',
    width: '30px',
    backgroundColor: '#f00'
};

var estilo2 = {
    height: '40px',
    width: '50px',
    backgroundColor: '#0f0'
};

var estilo3 = {
    height: '30px',
    width: '70px',
    backgroundColor: '#00f'
};

function style(element, config) {
    var style = element.style;
    
    for(var prop in config) {
        if(config.hasOwnProperty(prop)) {
            style[prop] = config[prop];               
        }
    }
}

style(document.getElementById('ejemplo_1'), estilo1);

style(document.getElementById('ejemplo_2'), estilo2);

style(document.getElementById('ejemplo_3'), estilo3);