The way this question is phrased makes it sound like homework, so it is your responsibility to put together the solution. We can point you in the right direction but you need to solve the problem yourself so you can learn. That being said, in Javascript you probably want to use regular expressions:
RegExp.prototype.test() - JavaScript | MDN[
^]
Regular expressions - JavaScript | MDN[
^]
A quick example:
const check = /^[0-9]+$/g;
const notNumber = check.test('abc123');
const yesNumber = check.test('12345');