phpjs
Version:
11 lines (10 loc) • 385 B
JavaScript
function is_bool(mixed_var) {
// From: http://phpjs.org/functions
// + original by: Onno Marsman
// + improved by: CoursesWeb (http://www.coursesweb.net/)
// * example 1: is_bool(false);
// * returns 1: true
// * example 2: is_bool(0);
// * returns 2: false
return (mixed_var === true || mixed_var === false); // Faster (in FF) than type checking
}