范围错误:x 无法转换为 BigInt,因为它不是整数
当对非整数数字使用 BigInt()
函数时,会发生 JavaScript 异常 "x 无法转换为 BigInt,因为它不是整数"。
¥The JavaScript exception "x can't be converted to BigInt because it isn't an integer" occurs when the BigInt()
function is used on a number that isn't an integer.
信息
错误类型
什么地方出了错?
¥What went wrong?
使用 BigInt()
函数将数字转换为 BigInt 时,该数字必须是整数(以便 Number.isInteger
返回 true)。
¥When using the BigInt()
function to convert a number to a BigInt, the number must be an integer (such that Number.isInteger
returns true).
示例
无效案例
有效案例
也可以看看
¥See also