blob: fae0cd160f5ded9bd619f6cd8e1e720999e1d860 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
---
title: BigInt.prototype.valueOf()
slug: Web/JavaScript/Reference/Global_Objects/BigInt/valueOf
tags:
- BigInt
- JavaScript
- Method
- Prototype
- Reference
- valueOf()
translation_of: Web/JavaScript/Reference/Global_Objects/BigInt/valueOf
original_slug: Web/JavaScript/Reference/Objets_globaux/BigInt/valueOf
---
{{JSRef}}
La méthode **`valueOf()`** renvoie la valeur primitive encapsulée dans un objet {{jsxref("BigInt")}}.
{{EmbedInteractiveExample("pages/js/bigint-valueof.html")}}
## Syntaxe
bigIntObj.valueOf()
### Valeur de retour
Un grand entier (_big int_) représentant la valeur primitive de l'objet {{jsxref("BigInt")}} courant.
## Exemples
### Utiliser `valueOf()`
```js
typeof Object(1n); // object
typeof Object(1n).valueOf(); // bigint
```
## Spécifications
| Spécification | État |
| ------------------------------------------------------------------------------------------------- | ----------------------- |
| [Proposition pour `BigInt`](https://tc39.github.io/proposal-bigint/#sec-bigint.prototype.valueof) | Proposition de niveau 3 |
## Compatibilité des navigateurs
{{Compat("javascript.builtins.BigInt.valueOf")}}
## Voir aussi
- {{jsxref("BigInt.prototype.toString()")}}
|