ength == 16 &amp;&amp;
                 cardNumber.indexOf('6011') == 0)
        {
             return 'discover';
        } 
        else if (cardNumber.indexOf('34') == 0 ||
                 cardNumber.indexOf('37') == 0 &amp;&amp;
                 cardNumber.length == 15)
        {
            return 'amex';
        }
        else if (cardNumber.indexOf('300') == 0 ||
                 cardNumber.indexOf('301') == 0 ||
                 cardNumber.indexOf('302') == 0 ||
                 cardNumber.indexOf(