Simple question, because in this section = > Number (! username) DO NOT invalidate 0 and tell me:
- 'Please enter a valid numeric value'
I know that if I pass the 0 to the prompt it returns a string but for that I have done Number (! username), now it is number. If Username already rejects me natively '0', '', null, undefined, false, and I have denied it ! UserName you should give me true and enter the block because I also converted it to a number with Number
I know that 0 is even, but before I told you to convert 0 string to numeric 0 and I know that a numeric 0 rejects it, BUT you should enter and use !
I do not understand this
let numeroUsuario, modulo;
for (var i = 0; i < 3; i++) {
numeroUsuario = prompt('Introduce un numero');
if (numeroUsuario === null) {
alert('Por favor, introduce algún valor.');
} else if(Number(!numeroUsuario) || isNaN(numeroUsuario) || numeroUsuario === '') {
alert('Por favor, introduce un valor numérico válido.');
} else {
if (numeroUsuario % 2 === 0) {
modulo = 'par';
alert('El numero ' + numeroUsuario + ' es ' + modulo);
} else {
modulo = 'impar';
alert('El numero ' + numeroUsuario + ' es ' + modulo);
}
}
}