How does it work ? What does the if condition do ?
function variableName(name) {
for (var i = 0; i < name.length; i++) {
if (!('a' <= name[i] && name[i] <= 'z' ||
'A' <= name[i] && name[i] <= 'Z' ||
'1' <= name[i] && name[i] <= '9' ||
name[i] === '_')) {
return false;
}
}
if ('0' <= name[0] && name[0] <= '9') {
return false;
}
return true;
}
I understand that he check the validation of the variable name , but I didn't understand what 'a' 'z' || 'A' 'Z' || refere to ?!
Aucun commentaire:
Enregistrer un commentaire