how to check boolean variable in javascript code example
Example 1: js is boolean
if (typeof variable === "boolean"){
// variable is a boolean
}
Example 2: javascript can a var be a boolean
var YES = new Boolean(true);
if (typeof variable === "boolean"){
// variable is a boolean
}
var YES = new Boolean(true);