What is the most efficient way to validate numbers in JavaScript?

Please let me know how to use IsNumeric() function in JavaScript to properly validate a number.

Comments

  • function isNumeric(number) {
      return !isNaN(parseFloat(number)) && isFinite(number);
    }
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion