JSFiddle - React, Tailwind, and code Playground
by slove
HTML
<ul id="results"></ul>
CSS
#results li.pass {
color: green;
}
#results li.fail {
color: red;
text-decoration:line-through
}
JavaScript
function assert(value, desc) {
var li = document.createElement("li");
li.className = value ? 'pass' : 'fail';
li.appendChild(document.createTextNode(desc));
document.getElementById('results').appendChild(li);
}
var Person = Object.subClass({
init: function (isDancing) {
this.dancing = isDancing;
},
dance: function () {
return this.dancing;
}
});
var person = new Person(true);
assert(person.dance(), 'This person is dancing');