const tests = [() => true, () => false, () => null, () => undefined];
console.log("Wrong way to handle conditional values");
tests.map(shoudRender => {
console.log(`value: ${shoudRender()} => `, {opacity: shoudRender() && "1"})
});
console.log("\nCorrect to handle conditional values");
tests.map(shoudRender => {
console.log(`value: ${shoudRender()} => `, {opacity: shoudRender() ? "1" : "0"})
});
To embed this project on your website, copy the following code and paste it into your website's HTML: