Answer the question
In order to leave comments, you need to log in
How can I make "args" only be numbers?
Here is the code:
let messageArray = message.content.split(" ");
let args = messageArray.slice(1);
if(!args[0]) return client.send("Укажите цифру");
Answer the question
In order to leave comments, you need to log in
Not sure what is broken? A string arrives, it is transferred to an array by spaces, then a new array is returned without the first element. So what difference does it make if the array contains a number or a letter?
And so - through isNaN (element) you can check whether it is a number or not.
Well, in general - it's easier on the client to limit the input format, if possible.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question