I'm struggling with getting a true return value for numbers that are integers and have either 4 or 6 digits - no decimals or letters allowed. The issue seems to be the validation of whether it's really a number and if it has a decimal point.
Although I believe I have applied the right functions, I can't seem to properly connect them to my if statement. I want to check if three different conditions are true before returning true, but I haven't quite figured it out yet.
If possible, please only provide a hint, a link, SUDO Code, or references I can explore. I'll follow up with the answer once I've solved it myself.
JS
function validatePIN (pin) {
//return true or false
var result = (pin - Math.floor(pin)) !== 0;
if( pin.length === 4 || isNaN(pin) || result) {
return true
} else if ( pin.length === 6 || isNaN(pin) || result) {
return true
} else return false
}
Thanks