JSFiddle - React, Tailwind, and code Playground

by David Thomas

HTML

<div id="comment"></div>
<div id="name"></div>
<div id="url"></div>

CSS

div {
    min-height: 2em;
    border: 2px solid #000;
}

JavaScript

[{
    "id": "comment",
    "color": "red"
}, {
    "id": "name",
    "color": "green"
}, {
    "id": "url",
    "color": "blue"
}].forEach(function (a) {
    document.getElementById(a.id).style.backgroundColor = a.color;
});