Menu
Hello, I have to do an exercise that I’m doing and we were asked to calculate the DNI through functions, so for the moment I know that type of calculator should follow me by giving you the code I have:
var dni = prompt (“Escriu el teu dni”)
function letraDNI(dni){
var cadena = [“T”, “R”, “W”, “A”, “G”, “M”, “Y”, “F”,”P”, “D”, “X”, “B”, “N”, “J”, “Z”, “S”, “Q”, “V”, “H”, “L”, “C”, “K”, “E”, “T”]
var poscion = dni%23;
var letra = cadena.substring(poscion,poscion+1);
return dni + ” – ” + letra;
}
document.write(letraDNI(dni));
If you could tell me how to continue thank you, a salute and I hope you’ll have a good day.