JSFiddle - React, Tailwind, and code Playground
by vasi_32
HTML
<p id="sometext">Change Color</p>
JavaScript
function paintRed() {
var text = document.getElementById('sometext');
text.style.color = "red";
}
function paintBlue() {
var text = document.getElementById('sometext');
text.style.color = "blue";
}
function paintYellow() {
var text = document.getElementById('sometext');
text.style.color = "yellow";
}
var arrcolor = [ paintRed, paintBlue, paintYellow];
arrcolor[2](); //This returns the yellow color and not red//