Javascript is_bool : Variable handling : PHP functions in JavaScript JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » PHP functions in JavaScript » Variable handling »

 

Javascript is_bool


Returns true if variable is a boolean
Example 1

Running
1.is_bool(false);

Could return
1.true
Example 2

Running
1.is_bool(0);

Could return
1.false
function is_bool(mixed_var)
{
    // Returns true if variable is a boolean  
    // 
    // version: 810.1317
    // discuss at: http://phpjs.org/functions/is_bool
    // +   original by: Onno Marsman
    // *     example 1: is_bool(false);
    // *     returns 1: true
    // *     example 2: is_bool(0);
    // *     returns 2: false
    return (typeof mixed_var == 'boolean');
}


HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo PHP functions in JavaScript
» Variable handling