JavaScript interprets an empty string as a 0, which then fails the isNAN test. You can use parseInt on the string first which won’t convert the empty string to 0. The result should then fail isNAN.
More Related Contents:
- How do you check that a number is NaN in JavaScript?
- Why does typeof NaN return ‘number’?
- How to turn NaN from parseInt into 0 for an empty string?
- Why is NaN === NaN false? [duplicate]
- How do you test for NaN in JavaScript?
- Is NaN equal to NaN?
- In JavaScript, why does zero divided by zero return NaN, but any other divided by zero return Infinity?
- Is Number.IsNaN() more broken than isNaN()
- Why is math.max() returning NaN on an array of integers?
- Why JavaScript says that a number is not a number? [duplicate]
- Sum numbers returns NaN
- How do I test for NaN? [duplicate]
- How to Deep clone in javascript
- React: “this” is undefined inside a component function
- How can I loop through ALL DOM elements on a page?
- Is there a difference between (function() {…}()); and (function() {…})();? [duplicate]
- How to find a number in a string using JavaScript?
- jQuery attr vs prop?
- Async Google Maps API v3 undefined is not a function [closed]
- How to format Vuetify data table date column?
- Bind more arguments of an already bound function in Javascript
- How can I retain the scroll position of a scrollable area when pressing back button?
- JSON security best practices?
- jquery only allow input float number
- Matched leaf route at location “/” does not have an element
- Angular 2 binding/events not working when adding template as innerHTML
- backbone.js structuring nested views and models
- What is the difference between $scope.$root and $rootScope?
- HTML5 Video autoplay with sound unmuted
- value of using React.forwardRef vs custom ref prop