Example 1: javascript sort boolean value
a = [false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];
a.sort(function(x, y) {
return (x === y)? 0 : x? -1 : 1;
});
console.log(a);
Example 2: js is boolean
if (typeof variable === "boolean"){
}
Example 3: change true to false js
var thing = true;
thing = !thing;
Example 4: javascript true string to boolean
var isHidden='true';
var isHiddenBool = (isHidden == 'true');