for(i=0;i<contacts.length;i++){
if((contacts[i].lname.toUpperCase().charAt(0))===(lastName.toUpperCase()))
window.alert("already exists");
}
Am I doing correct? It is not working even if lastName already exists! Is there any other way to compare Strings in Javascript?
not working?.charAt(0)? are you comparing first character withlastName?