The Number.MIN_SAFE_INTEGER
biểu diễn giá trị số nguyên an toàn lớn nhất trong JavaScript (-(253 - 1)
).
Tài nguyên dùng cho bài viết này được lưu trữ trong một kho của GitHub. Nếu bạn muốn đóng góp cho nó, hãy clone lại https://github.com/mdn/interactive-examples và gửi cho chúng tôi một pull request.
Property attributes of Number.MIN_SAFE_INTEGER |
|
---|---|
Writable | no |
Enumerable | no |
Configurable | no |
Mô tả
Hằng MAX_SAFE_INTEGER
có giá trị là -9007199254740991
(-9,007,199,254,740,991 hay là khoảng âm 9 triệu tỉ). Nguyên do đằng sau con số đó là do JavaScript sử dụng số thực dấu phẩy động độ chính xác kép được đặc tả trong chuẩn IEEE 754 và chỉ có thể biểu diễn an toàn các số trong khoảng -(253 - 1)
và 253 - 1
. Xem Number.isSafeInteger()
để biết thêm chi tiết.
Bởi vì MIN_SAFE_INTEGER
là một thuộc tính tĩnh của Number
, bạn thường dùng nó bằng Number.MIN_SAFE_INTEGER
, thay vì tự tạo ra thuộc tính cho object Number
.
Ví dụ
Number.MIN_SAFE_INTEGER // -9007199254740991 -(Math.pow(2, 53) - 1) // -9007199254740991
Đặc tả
Đặc tả | Trạng thái | Ghi chú |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Number.MIN_SAFE_INTEGER' in that specification. |
Standard | Định nghĩa lần đầu. |
ECMAScript Latest Draft (ECMA-262) The definition of 'Number.MIN_SAFE_INTEGER' in that specification. |
Draft |
Trình duyệt hỗ trợ
Bảng trình duyệt hỗ trợ trong trang này được sinh từ cấu trúc dữ liệu. Nếu bạn muốn đóng góp cho khối dữ liệu, hãy xem qua https://github.com/mdn/browser-compat-data và gửi cho chúng tôi pull request.
Desktop | Mobile | Server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
MIN_SAFE_INTEGER | Chrome Full support 34 | Edge Full support 12 | Firefox Full support 31 | IE No support No | Opera Full support Yes | Safari Full support 9 | WebView Android Full support Yes | Chrome Android Full support 34 | Firefox Android Full support 31 | Opera Android Full support Yes | Safari iOS Full support 9 | Samsung Internet Android Full support Yes | nodejs Full support 0.12 |
Legend
- Full support
- Full support
- No support
- No support