[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Guide/Numbers_and_strings [Back]  [Original]

- JavaScript | MDN

MDN Web Docs

View in English Always switch to English

JavaScript 2

JavaScript 64 IEEE 754 (2^1022 2^+1023 10^308 10^+308 53 ) 2^53 1

3 Infinity-InfinityNaNnot-a-number

JavaScript JavaScript

4 10 2 8 16

10

js
1234567890
42

10 (0) 10 0 8 8 0 8 10 0o

js
0888 // 10  888 
0777 // 8  10  511 

2

2 "B" (0b 0B)0b 0 1 SyntaxError: "Missing binary digits after 0b"0b 2

js
0b10000000000000000000000000000000 // 2147483648
0b01111111100000000000000000000000 // 2139095040
0B00000000011111111111111111111111 // 8388607

8

8 0o

js
0O755 // 493
0o644 // 420

8 8 0 0644 === 420 "\045" === "%" 0 0 7 10

js
const n = 0755; // 493
const m = 0644; // 420

8

16

16 "X" (0x 0X)0x (0123456789ABCDEF) SyntaxError: "Identifier starts immediately after numeric literal" ()

js
0xFFFFFFFFFFFFF // 4503599627370495
0xabcdef123456  // 188900967593046
0XA             // 10

js
0e-5   // 0
0e+5   // 0
5e1    // 50
175e-2 // 1.75
1e3    // 1000
1e-3   // 0.001
1E3    // 1000

(_)

js
1_000_000_000_000
1_050.95
0b1010_0001_1000_0101
0o2_2_5_6
0xA0_B0_C0
1_000_000_000_000_000_000_000n

Number

Number NaN

js
const biggestNum = Number.MAX_VALUE;
const smallestNum = Number.MIN_VALUE;
const infiniteNum = Number.POSITIVE_INFINITY;
const negInfiniteNum = Number.NEGATIVE_INFINITY;
const notANum = Number.NaN;

Number Number

Number

Number.MAX_VALUE (1.7976931348623157e+308)
Number.MIN_VALUE (5e-324)
Number.NaN
Number.NEGATIVE_INFINITY
Number.POSITIVE_INFINITY
Number.EPSILON 1 Number 1 ()(2.220446049250313e-16)
Number.MIN_SAFE_INTEGER JavaScript (2^53 + 1, or 9007199254740991)
Number.MAX_SAFE_INTEGER JavaScript (+2^53 1, or +9007199254740991)
Number.parseFloat() parseFloat()
Number.parseInt() parseInt()
Number.isFinite()
Number.isInteger()
Number.isNaN() NaN isNaN()
Number.isSafeInteger()

Number Number Number.prototype

toExponential()
toFixed()
toPrecision()

Math

Math Math PI (3.141)

js
Math.PI;

Math sin

js
Math.sin(1.56);

Math

Math

Math
abs()
sin(), cos(), tan()
asin(), acos(), atan(), atan2()
sinh(), cosh(), tanh()
asinh(), acosh(), atanh()

pow(), exp(), expm1(), log(), log10(), log1p(), log2()

floor(), ceil()
min(), max()
random() 0 1
round(), fround(), trunc(),
sqrt(), cbrt(), hypot()
sign()
clz32(),
imul()
32
2 C 32

Math Math

64 IEEE 754 Number.MAX_SAFE_INTEGER (253 - 1) i64 64 i128 128 JavaScript (BigInt)

n

js
const b1 = 123n;
// 
const b2 = -1234567890987654321n;

BigInt

js
const b1 = BigInt(123);
// 
// 
const b2 = BigInt("-1234567890987654321");

js
const integer = 12 ** 34; // 4.9222352429520264e+36
const bigint = 12n ** 34n; // 4922235242952026704037113243122008064n

js
const bigintDiv = 5n / 2n; // 2n 2.5 

Math

BigInt

JavaScript 16 (UTF-16) 0 1

js
'foo'
"bar"

\

16

\x 16

js
"\xA9" // ""

Unicode

Unicode \u 4

js
"\u00A9" // ""

Unicode

Unicode 16 0x10FFFF Unicode Unicode

String.fromCodePoint() String.prototype.codePointAt()

js
"\u{2F804}"

//  Unicode 
"\uD87E\uDC04"

String

js
console.log("hello".toUpperCase()); // HELLO

(String)

2 RegExp Intl

(`) (${expression})

js
console.log(
  " 1\n\
 2",
);
// " 1
//  2"

js
console.log(` 1
 2`);
// " 1
//  2"

js
const five = 5;
const ten = 10;
console.log(
  "Fifteen is " + (five + ten) + " and not " + (2 * five + ten) + ".",
);
// "Fifteen is 15 and not 20."

js
const five = 5;
const ten = 10;
console.log(`Fifteen is ${five + ten} and not ${2 * five + ten}.`);
// "Fifteen is 15 and not 20."

JavaScript


Web Proxy Viewer  |  New URL  |  Original Page