LoginSignup
2
1

More than 5 years have passed since last update.

JavaScript の Number の最大値

Last updated at Posted at 2019-02-28

事象

// 20 桁の整数
console.log(12345678901234567890); // 12345678901234567000 (18 - 20 桁目が 000 になってしまった)

Number.MAX_VALUE

// JavaScript において表すことが可能な最大数
console.log(Number.MAX_SAFE_INTEGER); // 9007199254740991
// Integer かどうか
console.log(Number.isInteger(12345678901234567890)); // true
// safe integer かどうか
console.log(Number.isSafeInteger(12345678901234567890)); // false
var x = 12345678901234567890;
var y = 12345678901234567891;
console.log(x === y); // true

おまけ

JSON Viewer (JSON Formatter) を利用していて気づきました
json_formatter.png

参考

2
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1