Answers for "convert to true false js"

1

convert string to boolean js

var myBool = Boolean("false");  // == true

var myBool = !!"false";  // == true
Posted by: Guest on October-14-2021
6

convert string true to boolean true javascript

stringToBoolean: function(string){
    switch(string.toLowerCase().trim()){
        case "true": case "yes": case "1": return true;
        case "false": case "no": case "0": case null: return false;
        default: return Boolean(string);
    }
}
Posted by: Guest on May-05-2020

Code answers related to "convert to true false js"

Browse Popular Code Answers by Language