0

I am writing a discord bot and I have a variable. Users query the license plate with this command Ex.(!qq TR 34)

I just want the plate to check the number entry, if a letter or special character is entered ex.(!qq TR 34ü,) and error to the user please do not use special characters or letters how can I do it

if (countryID.length < 1)
        return message.channel.sendEmbed(usageCommand);
    else if (plaque.length == countryID.length)
        return message.channel.sendEmbed(usageCommand);
else
Burcu
  • 57
  • 6

1 Answers1

2

burcu.

NaN Errors occur when a string that cannot be a number is made into a number.

You can determine whether the entered string can be converted to a number.

Docs - isNaN

ex

isNaN('34')     // false;
isNaN('34ü')    // true;
Lucas
  • 128
  • 7