title: Typescript: How to make array.indexOf case insensitive search
body: <p>This below code(<code>forbiddenNames</code> method) is working for case sensitive only. But i want to make it working for case insensitive too. How to make this working? </p>
  
  <p>E.g. 
  If search text "ashutosh"(instead of "Ashutosh")then also it should able search in array <code>forbiddenUsernames</code> </p>
  
  <hr>
  
  <p>CODE</p>
  
  <p>template:</p>
  
  <pre><code>&lt;input type="text" id="username" class="form-control" formControlName="username"&gt;
  </code></pre>
  
  <p>Class</p>
  
  <pre><code> forbiddenUsernames = ['Chris', 'Ashutosh'];
  
  
    ngOnInit() {
      this.signupForm = new FormGroup({
          'username': new FormControl(null, [Validators.required, this.forbiddenNames.bind(this)]) 
      });
    }
  
  
  // validator is just a function, its our own validator
    forbiddenNames(control: FormControl): {[s: string]: boolean} {
      if (this.forbiddenUsernames.indexOf(control.value)  !== -1 ) { //  "-1" -  did not find a match
        return { 'nameIsForbidden' : true };
      }
    }
  </code></pre>
  
  <blockquote>
    <p>Case sensitive case</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/gsKRL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gsKRL.jpg" alt="Case sensitive case"></a></p>
  
  <pre><code>Case In-sensitive case
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/enbGL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/enbGL.jpg" alt="Case In-sensitive case"></a>
  Please let me know if question is not clear, i will explain you</p>