function validatePIN(pin) {
    if (pin.length == 4 || pin.length == 6) {

  
        if (isNaN(pin) == true) {
            return false
        }
        else if (pin < 0) { return false }
        else if (pin.startsWith('+', '-', ' ', '.')) { return false }
        else if (pin.includes('.', "'", "+", " ")) { return false }
        else if(pin.endsWith('\n')){return false}
        else {
            return true
        }
    } else { return false }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: