Setting javascript variable to false?

From: Date: Thu, 12 Mar 2020 20:21:53 +0000
Subject: Setting javascript variable to false?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-327019@lists.php.net to get a copy of this message
Hello; I have javascript global variable in a page that is supposed to be initialized by php: // $dual is boolean true/false var dual = <?php print $dual ?> But what happens when the page loads is: var dual = ; // true/false is not written to the page. javascript syntax checker complains. How would I output a string version of true/false that javascript will see as a boolean value? I had been sending $dual as 'true'/'false' but then when checking dual: if(dual) { // if dual is the string 'false', the test passes. } Thank you for time and attention JK

« previous php.general (#327019) next »