<title>JavaScript Convert String to Boolean</title>
function stringToBoolean(value){
return (String(value) === '1' || String(value).toLowerCase() === 'true');
console.log(stringToBoolean(true));
console.log(stringToBoolean("true"));
console.log(stringToBoolean("True"));
console.log(stringToBoolean("TRUE"));
console.log(stringToBoolean(false));
console.log(stringToBoolean("false"));
console.log(stringToBoolean("False"));
console.log(stringToBoolean(undefined));
console.log(stringToBoolean(null));
console.log(stringToBoolean(1));
console.log(stringToBoolean(0));
<p><strong>Note:</strong> Press Ctrl+Shift+J (Windows / Linux) or Cmd+Opt+J (Mac) to open Browser Console panel.</p>