how to check if variable is a boolean js code example
Example 1: js is boolean
if (typeof variable === "boolean"){
// variable is a boolean
}
Example 2: javascript check if true force to be boolean
var obj = {a: 1}
var to_bool_way1 = Boolean(obj) // true
var to_bool_way2 = !!obj // true