JSFiddle - React, Tailwind, and code Playground
HTML
<div id="console-log"><h3>Output:</h3></div>
CSS
.console-line
{
font-family: monospace;
margin: 2px;
}
JavaScript
var consoleLine = "<p class=\"console-line\"></p>";
console = {
log: function (text) {
$("#console-log").append($(consoleLine).html(text));
}
};
// Enter code below
function Rabbit(adjective) {
this.describeMyself = function() {
console.log("I am " + ((adjective.search(/\b[aeiou]/i) >= 0) ? "an " : "a ") + adjective + " rabbit.");
};
}
// now we can easily make all of our rabbits
var adj = ['fluffly', 'happy', 'Anxious', 'excited'];
adj.forEach(function(a) {
var r = new Rabbit(a);
r.describeMyself();
});