Skip to content

Commit 1e65c2f

Browse files
authored
[Term Entry] JavaScript Number Methods: .MAX_VALUE
* Create new .md entry for JavaScript .MAX_VALUE * Update max-value.md * Minor changes * Rename max-value.md to MAX-VALUE.md ---------
1 parent b978f5d commit 1e65c2f

File tree

1 file changed

+56
-0
lines changed
  • content/javascript/concepts/number-methods/terms/MAX-VALUE

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
Title: '.MAX_VALUE'
3+
Description: 'Represents the largest numeric value that can be represented in JavaScript.'
4+
Subjects:
5+
- 'Computer Science'
6+
- 'Web Development'
7+
Tags:
8+
- 'JavaScript'
9+
- 'Methods'
10+
- 'Numbers'
11+
CatalogContent:
12+
- 'introduction-to-javascript'
13+
- 'paths/front-end-engineer-career-path'
14+
---
15+
16+
JavaScript's **`.MAX_VALUE`** represents the largest positive numeric value that can be represented using the `Number` type before it overflows to `Infinity`.
17+
18+
## Syntax
19+
20+
```pseudo
21+
Number.MAX_VALUE;
22+
```
23+
24+
**Parameters:**
25+
26+
None: `.MAX_VALUE` is a static property of the Number object.
27+
28+
**Return value:**
29+
30+
A number representing the largest positive finite value JavaScript can represent using the `Number` type (approximately 1.7976931348623157e+308).
31+
32+
## Example
33+
34+
This example shows what happens when a number exceeds `.MAX_VALUE`:
35+
36+
```js
37+
const large = Number.MAX_VALUE * 2;
38+
console.log(large);
39+
```
40+
41+
The output generated by this code is:
42+
43+
```shell
44+
Infinity
45+
```
46+
47+
Multiplying beyond `.MAX_VALUE` causes the result to overflow to `Infinity`, since JavaScript can't represent values larger than this limit.
48+
49+
## Codebyte Example
50+
51+
This codebyte example checks whether a large number is still within JavaScript's numeric limit:
52+
53+
```codebyte/javascript
54+
const safe = 1e+307;
55+
console.log(safe < Number.MAX_VALUE);
56+
```

0 commit comments

Comments
 (0)