JSFiddle - React, Tailwind, and code Playground
HTML
<div id="output"></div>
JavaScript
var foo = 'hello';
var fooNull = null;
var fooFalse = false;
var fooBlank = '';
var fooZero = 0;
function print(value) {
var printStuff = '';
if (value) {
printStuff += value;
} else {
printStuff += 'no value';
}
// This outputs the value in a paragraph tag to the div
var node = document.createElement("P");
var textnode = document.createTextNode(printStuff);
node.appendChild(textnode);
document.getElementById('output').appendChild(node);
}
print(foo);
print(fooNull);
print(fooFalse);
print(fooBlank);
print(fooZero);