Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

JavaScript IsNumber Function

DZone's Guide to

JavaScript IsNumber Function

·
Free Resource
JavaScript function that determines if a variable is an actual Number object and not NaN or +/- Infinity.


function isNumber(x) 
{ 
  return ( (typeof x === typeof 1) && (null !== x) && isFinite(x) );
}
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}