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);
}
}
// Everyone does one extra check. Here is a better answer
let toBool = string => string === 'true'; // ? true : false;
// Not everyone gets ES6 so here for the beginners
function toBool(string){
return string === 'true';
}
// In React Or Node Js Or Any JavaScript Framework
const AnyName = JSON.parse("true"); //YourSreing
//Now You data converted Boolean Value
// This is how it should be if you store the database
AnyName : true,