javascript var boolean code example
Example 1: boolean as string javascript
bool.toString()
Example 2: javascript can a var be a boolean
var YES = new Boolean(true);
Example 3: javascript function return boolean
function func(){
return true;
}
isBool = func();
console.log(typeof (isBool)); // output - string
let isBool = func();
console.log(typeof (isBool)); // output - boolean
Example 4: javascript true string to boolean
var isHidden='true';
var isHiddenBool = (isHidden == 'true');