JSFiddle - React, Tailwind, and code Playground

by BDG

HTML

<pre class="log"></pre>

JavaScript

var logLine = function(comment) {
    var self=this;
    self.count = self.count + 1 || 0;
    comment = comment || "undescribed event";
    $("pre.log").append(self.count + " - " +comment + "\n");
}
    
logLine("Comment 1");
logLine();//No comment provided
logLine("Comment 3");