function isBracketsBalanced(str) {
    var Map = Array();
    Map[']'] = '[';
    Map[')'] = '(';
    Map['}'] = '{';
    Map['>'] = '<';
    var stack = Array();
    for (var i = 0; i < str.length; i++) {
        switch (str[i]) {
            case '[':
            case '(':
            case '{':
            case '<':
                stack.push(str[i]);
                break;
            case ']':
            case ')':
            case '}':
            case '>':
                if (!((stack.length > 0) && (Map[str[i]] == stack.pop()))) 
                    return false;
                else
                    break;
            default:
                break;
        }
    }
    return stack.length == 0;
}
/**
 * Returns true if the specified string has the balanced brackets and false otherwise.
 * Balanced means that is, whether it consists entirely of pairs of opening/closing brackets
 * (in that order), none of which mis-nest.
 * Brackets include [],(),{},<>
 *
 * @param {string} str
 * @return {boolean}
 *
 * @example:
 *   '' => true
 *   '[]'  => true
 *   '{}'  => true
 *   '()   => true
 *   '[[]' => false
 *   ']['  => false
 *   '[[][][[]]]' => true
 *   '[[][]][' => false
 *   '{)' = false
 *   '{[(<{[]}>)]}' = true 
 */
Returns true if the specified string has the balanced brackets and false otherwise.
Balanced means that is, whether it consists entirely of pairs of opening/closing brackets
(in that order), none of which mis-nest.

@param {string} str
@return {boolean}


Returns true if the specified string has the balanced brackets and false otherwise . Balanced means that is whether it consists entirely of pairs of opening / closing brackets ( in that order ) none of which mis - nest . @param { string } str @return { boolean }
function isBracketsBalanced(str) {
    var Map = Array();
    Map[']'] = '[';
    Map[')'] = '(';
    Map['}'] = '{';
    Map['>'] = '<';
    var stack = Array();
    for (var i = 0; i < str.length; i++) {
        switch (str[i]) {
            case '[':
            case '(':
            case '{':
            case '<':
                stack.push(str[i]);
                break;
            case ']':
            case ')':
            case '}':
            case '>':
                if (!((stack.length > 0) && (Map[str[i]] == stack.pop()))) 
                    return false;
                else
                    break;
            default:
                break;
        }
    }
    return stack.length == 0;
}
function isBracketsBalanced ( str ) { var Map = Array ( ) ; Map [ ']' ] = '[' ; Map [ ')' ] = '(' ; Map [ '}' ] = '{' ; Map [ '>' ] = '<' ; var stack = Array ( ) ; for ( var i = 0 ; i < str . length ; i ++ ) { switch ( str [ i ] ) { case '[' : case '(' : case '{' : case '<' : stack . push ( str [ i ] ) ; break ; case ']' : case ')' : case '}' : case '>' : if ( ! ( ( stack . length > 0 ) && ( Map [ str [ i ] ] == stack . pop ( ) ) ) ) return false ; else break ; default : break ; } } return stack . length == 0 ; }
Returns true if the specified string has the balanced brackets and false otherwise.
Returns true if the specified string has the balanced brackets and false otherwise .