javascript boolean function code example
Example 1: js is boolean
if (typeof variable === "boolean"){
// variable is a boolean
}
Example 2: 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 3: javascript true string to boolean
var isHidden='true';
var isHiddenBool = (isHidden == 'true');