In Java, the equalsIgnoreCase()
method is used to check case sensitivity. In Javascript?
I have the following example: perform the function " existeDisco(titulo):boolean
".
Returns true if the disk whose title matches the one passed as a parameter exists. The method is case-insensitive.
Code of the requested function:
this.existeDisco = function (nombreRecibido){
for(var i=0; i<this.arrayDiscos.length; i++){
var nombre = this.arrayDiscos[i].nombre;
if(nombre == nombreRecibido)
return this.arrayDiscos[i];
}
return false;
}
How do we make the function detect the nombreRecibido
in uppercase or lowercase as long as it is the exact name? That is to say: "Fernando" or "FERNANDO" or "fernando".