UNPKG

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