JSFiddle - React, Tailwind, and code Playground
by Alex Fogarty
HTML
<p id="output"></p>
CSS
p {
color: red;
}
JavaScript
function addOne() {
var responses = ["Hell, no", "That'd be a no", "Uhhh, yeah, no"];
var randResponse = responses[Math.floor(Math.random() * responses.length)];
var age = 9;
var newAge = age + 7;
if (newAge >= 21) {
document.getElementById("output").innerHTML = "You can buy beer!";
} else {
document.getElementById("output").innerHTML = randResponse;
}
}
addOne();