How to convert a string to a bool in Javascript?
The easiest way to convert string to boolean is to compare the string with 'true':
let myBool = (myString === 'true');
let myString = 'true';
let myBool = (myString.toLowerCase() === 'true'); // true
console.log(myBool);
myString = 'False';
myBool = (myString.toLowerCase() === 'true'); // false
console.log(myBool);
myString = 'Test';
myBool = (myString.toLowerCase() === 'true'); // false
console.log(myBool);