JSFiddle - React, Tailwind, and code Playground

by dhoerster

HTML

True/false truthy/falsy
<br/><hr/>

<ul></ul>

JavaScript

var x = 3,
    z = false,
    zero = 0,
    theUL = $('ul');

theUL.append('<li>X double equals "3" :: ' + (x == "3") + '</li>'); //truthy
theUL.append('<li>X triple equals "3" :: ' + (x === "3") + '</li>'); //false!
theUL.append('<li>X triple equals "3" to number :: ' + (x === +"3") + '</li>'); //true!
theUL.append('<li>Z double equals 0 :: ' + (z == 0) + '</li>'); //truthy
theUL.append('<li>Z double equals "0" :: ' + (z == "0") + '</li>'); //truthy
theUL.append('<li>Z triple equals "false" :: ' + (z === "false") + '</li>'); //false
theUL.append('<li>Z triple equals "false" to bool :: ' + (z === !!"false") + '</li>'); //false
theUL.append('<li>Z triple equals 0 to bool :: ' + (z === !!zero) + '</li>'); //true!


//theUL.append('<li>"$" + 3 + 4 = ' + ("$" + 3 + 4) + '</li>');