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
Post a Comment