Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2020年9月.
BigInt() コンストラクターは長整数型の値を返します。
作成しようとしているオブジェクトの数値。文字列、整数、論理値、長整数のいずれかにすることができます。
長整数 (BigInt) 値です。数値は整数でなければならず、長整数に変換されます。論理値 true は 1n に、false は 0n に変換されます。文字列は整数リテラル用のソーステキストとして解析されます。つまり、先頭や末尾に空白を含み、0b、0o、0x で始まることができます。
引数が整数でない場合に発生します。
TypeError以下のどちらかの場合に発生します。
SyntaxError引数が BigInt として解析できない文字列の場合に発生します。
BigInt() は、数値が例外を発生させずに長整数に変換できる唯一のケースです。これはとても明示的だからです。ただし、整数のみが許可されます。
| ECMAScript® 2027 Language Specification # sec-bigint-constructor |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年11月30日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.