You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Types in this module do not distinguish between primitives and objects. For example, `5` and `new Number(5)` are both of type "number".
36
+
37
+
A descriptor is a boolean value that is `true` if it applies to the value being tested. Type names are included as descriptors. For example, `5` is associated with the _primitive_, _number_, and _finite_ descriptors, among others.
44
38
45
39
| Descriptor | Type Name | Primitive Values | Instances Of Classes
46
40
| - | - | - | -
47
41
| defined | | not undefined | `Object`
48
42
|**undefined**| yes | undefined |
49
-
| primitive ||not an instance of `Object`|
50
-
| **object** | yes | | `Object`
43
+
| primitive ||any primitive value |
44
+
| **object** | yes[^1] | | `Object`
51
45
| objectish | | `null` | `Object`
52
46
|**null**| yes |`null`|
53
47
| nullish || undefined, `null`|
@@ -61,7 +55,8 @@ For example, these are equivalent:
| **nan** | yes | `NaN` | `Number` with value `NaN`
63
57
| **number** | yes | `0`, `5`, `Infinity` | `Number` excluding those with value `NaN`
64
-
| real | | `0`, `5` | `Number` with a real number value
58
+
| real[^2] | | `0`, `5` | `Number` with a finite number value
59
+
| <aname="finite"></a>finite | | `0`, `5` | `Number` with a finite number value
65
60
| infinite | | `Infinity` | `Number` with an infinite value
66
61
| **string** | yes | `""`, `"foo"` | `String`
67
62
| **array** | yes | `[]`, `[1,2]` | `Array`
@@ -77,6 +72,6 @@ For example, these are equivalent:
77
72
| **promise** | yes | | `Promise`
78
73
| **regex** | yes | | `Regex`
79
74
80
-
## Math Note
81
75
82
-
Note that JavaScript doesn't always treat mathematical expressions of undefined or indeterminate form as you might expect. For example, `1/0` is an undefined form, but JavaScript evaluates it as `Infinity`.
76
+
[^1]: The "object" type is only used for a value if no other type is appropriate.
77
+
[^2]: Deprecated. Use [_finite_](#finite) instead.
0 commit comments