hasNumericValue.md (1392B)
1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> 2 3 # Function hasNumericValue 4 5 Test whether a value is an numeric value. 6 7 In case of a string, true is returned if the string contains a numeric value. 8 9 10 ## Syntax 11 12 ```js 13 math.hasNumericValue(x) 14 ``` 15 16 ### Parameters 17 18 Parameter | Type | Description 19 --------- | ---- | ----------- 20 `x` | * | Value to be tested 21 22 ### Returns 23 24 Type | Description 25 ---- | ----------- 26 boolean | Returns true when `x` is a `number`, `BigNumber`, `Fraction`, `Boolean`, or a `String` containing number. Returns false for other types. Throws an error in case of unknown types. 27 28 29 ### Throws 30 31 Type | Description 32 ---- | ----------- 33 34 35 ## Examples 36 37 ```js 38 math.hasNumericValue(2) // returns true 39 math.hasNumericValue('2') // returns true 40 math.isNumeric('2') // returns false 41 math.hasNumericValue(0) // returns true 42 math.hasNumericValue(math.bignumber(500)) // returns true 43 math.hasNumericValue(math.fraction(4)) // returns true 44 math.hasNumericValue(math.complex('2-4i') // returns false 45 math.hasNumericValue([2.3, 'foo', false]) // returns [true, false, true] 46 ``` 47 48 49 ## See also 50 51 [isZero](isZero.md), 52 [isPositive](isPositive.md), 53 [isNegative](isNegative.md), 54 [isInteger](isInteger.md), 55 [isNumeric](isNumeric.md)