lundi 1 juin 2015

If statement checks regardless of the case of the letters

I want to make my if statement flexible. If I input an exact info in my input box, my statement triggers but if the user put it in lower case or uppercase it cannot be detected. Here are the codes.

var find = _.findWhere($scope.allCast, {name: castName});
            if(!find){
                var cast = {
                    cpPortfolioItemId: id,
                    name: castName,
                    job: 'cast',
                    role: castRole
                };
                ContentAssessmentFactory.addCastDetail(cast);
            }else{
                $window.alert('Cast name is already exist.');
            }

Any help would be so much appreciated.

Aucun commentaire:

Enregistrer un commentaire