JavaScript – Check if input is a number

I’m facing the following (basic) problem: I want to check if an input from an HTML-input field is not greater than 5 or not a number. If this is given the function should return true. Otherwise (so if greater than 5 or a number) it should resturn false. The validation if the number is not greater than 5 works fine so far but when I add the typeof-argument this one doesn’t works.
This is my code so far, thanks in advance!

function isValidStart(start) {
if (start.trim().length > 5 || typeof(start) === 'number') {
   return false
 return true

174 thoughts on “JavaScript – Check if input is a number”

  1. Its like you read my mind! You seem to know a lot about this, like you wrote the book in it or something.
    I think that you can do with some pics to drive the message home a little bit, but other than that, this is great blog.

    A great read. I’ll certainly be back.

  2. Pingback: buy ivermectil
  3. Fantastic site you have here but I was curious if you knew
    of any forums that cover the same topics discussed in this article?
    I’d really love to be a part of online community where I can get responses from
    other experienced individuals that share the same interest.
    If you have any suggestions, please let me know. Cheers!

  4. I like what you guys tend to be up too. This type of clever work and reporting!
    Keep up the very good works guys I’ve included you guys to my own blogroll.

  5. Yesterday, while I was at work, my sister stole my apple ipad and tested
    to see if it can survive a 30 foot drop, just so she can be a youtube sensation. My apple
    ipad is now destroyed and she has 83 views.
    I know this is totally off topic but I had to share it with someone!

  6. Does your website have a contact page? I’m having trouble
    locating it but, I’d like to shoot you an email. I’ve got some recommendations for your blog you might
    be interested in hearing. Either way, great website and I look forward to seeing it grow over

  7. Pingback: deltasone buy now
  8. Pingback: stromectol 6mg
  9. Pingback: ivermectine

Leave a Comment