Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
JavaScript の例外 "radix must be an integer at least 2 and no greater than 36" は、 Number.prototype.toString() メソッドまたは BigInt.prototype.toString() メソッドのオプションの radix 引数が指定されたものの、 2 から 36 までの範囲になかったときに発生します。
Number.prototype.toString() メソッドまたは BigInt.prototype.toString() メソッドのオプションの radix 引数が指定されています。この引数は、数値を表すために使用する基数を指定する 2 から 36 の整数 (数) でなければなりません。例えば、 10 進数の数値 169 は 16 進数では A9 と表現されます。
なぜ上限が 36 なのでしょうか? 10 よりも大きい基数の場合は、アルファベットが数値として用いられます。したがって、 (英語およびほかの多くの言語で用いられる) ラテン文字のアルファベットは 26 文字しかないため、基数は 36 以上にすることができません。
一般的な基数には、次のものがあります。
This page was last modified on 2023年8月18日 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.