Articles → JAVASCRIPT → Convert String To Boolean Value In Javascript
Convert String To Boolean Value In Javascript
Code
<script>
var stringValue = "TRUE";
var bool_value = stringValue.toLowerCase() === 'true';
// Returns true
console.log(bool_value);
stringValue = "False";
bool_value = stringValue.toLowerCase() === 'true';
// Returns false
console.log(bool_value);
</script>
Output