javascript - whats the error? Expected !untrusted = true, and got false -


why !untrusted false?. thanks

var trusted="true" var untrusted="false"  console.log(trusted,!trusted)             //true,false console.log(untrusted,!untrusted)         //false,false 

the reason seeing ouput because non-empty string true. using string value, should boolean,

var trusted=true; var untrusted=false; 

demo

var trusted=true;  var untrusted=false;  console.log(trusted,!trusted);        console.log(untrusted,!untrusted);


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -