i want to get two msgs when user type special character like m@rk @l@n with the help of charCodeAt();
my code gives an repeated answer if i enter normal text or if i enter spec char it gives my both condition true
var username = prompt("Enter Username");
var boolean = true;
for(var i=0;i<username.length;i++){
if(username[i].charCodeAt()==33 || username[i].charCodeAt()==44 || username[i].charCodeAt()==46 || username[i].charCodeAt()==64){
document.write("Wrong input: "+username);
boolean=true;
break;
}
else{
document.write("correct input "+username);
}
}