JSFiddle - React, Tailwind, and code Playground
JavaScript
function testFoo(foo) {
console.group();
if (foo) {
console.log(foo, "truthy");
} else {
console.log(foo, "falsey");
}
if (!!foo) {
console.log(!!foo, "truthy");
} else {
console.log(!!foo, "falsey");
}
console.groupEnd();
}
testFoo();
testFoo('');
testFoo(null);
testFoo('0');
testFoo(0);
testFoo('1');
testFoo(1);
testFoo(true);
testFoo(false);