JSFiddle - React, Tailwind, and code Playground
listing true and falsy values
by jonchius
HTML
<ul id="output"></ul>
JavaScript
initialize();
function initialize() {
var x = [];
x.push(0, 1, 2, "", "0", null, undefined, NaN);
// evaluates and prints the value of each of the above
$.each(x, function(i, v) {
if (i >= 3) {
// evaluate and print integers
$("#output").append("<li>" + "\"" + String(v) + "\" is " + Boolean(v) + "</li>");
} else {
// evaluate and print non-integers
$("#output").append("<li>" + v + " is " + Boolean(v) + "</li>");
}
});
}