Determines if the specified variable (string or number) can be parsed as a number.

Parameters:
NameTypeDescription
number
numberstring | number

The number variable to be checked.

Since
  • 3.1.0
Returns:

Returns true if the specified variable is a number. Returns false otherwise.

Type: 
boolean
Example
import { isNumber } from "@gravityforms/utils";

function Example() {
	 let isnum = isNumber( 1.25 ); //yes
	 isnum = isNumber( '3.5' ); //yes
	 isnum = isNumber( '$3.5' ); //no
}