| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Guide/Numbers_and_strings | [Back] [Original] |
Get to know MDN better
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
1234567890
42
0888 // 10 888
0777 // 8 10 511
2 "B" (0b 0B)0b 0 1 SyntaxError: "Missing binary digits after 0b"0b 2
0b10000000000000000000000000000000 // 2147483648
0b01111111100000000000000000000000 // 2139095040
0B00000000011111111111111111111111 // 8388607
8 0o
0O755 // 493
0o644 // 420
8 8 0 0644 === 420 "\045" === "%" 0 0 7 10
const n = 0755; // 493
const m = 0644; // 420
16 "X" (0x 0X)0x (0123456789ABCDEF) SyntaxError: "Identifier starts immediately after numeric literal" ()
0xFFFFFFFFFFFFF // 4503599627370495
0xabcdef123456 // 188900967593046
0XA // 10
0e-5 // 0
0e+5 // 0
5e1 // 50
175e-2 // 1.75
1e3 // 1000
1e-3 // 0.001
1E3 // 1000
(_)
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 NaN
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 PI (3.141)
Math.PI;
Math sin
Math.sin(1.56);
Math
Math
abs() |
|
sin(),
cos(),
tan()
|
|
asin(),
acos(),
atan(),
atan2()
|
|
sinh(),
cosh(),
tanh()
|
|
asinh(),
acosh(),
atanh()
|
|
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
const b1 = 123n;
//
const b2 = -1234567890987654321n;
const b1 = BigInt(123);
//
//
const b2 = BigInt("-1234567890987654321");
const integer = 12 ** 34; // 4.9222352429520264e+36
const bigint = 12n ** 34n; // 4922235242952026704037113243122008064n
const bigintDiv = 5n / 2n; // 2n 2.5
Math
'foo'
"bar"
\
\x 16
"\xA9" // ""
Unicode \u 4
"\u00A9" // ""
Unicode 16 0x10FFFF Unicode Unicode
String.fromCodePoint() String.prototype.codePointAt()
"\u{2F804}"
// Unicode
"\uD87E\uDC04"
console.log("hello".toUpperCase()); // HELLO
(String)
at(), charAt(), charCodeAt(), codePointAt() indexOf(), lastIndexOf(), startsWith(), endsWith(), includes(), match(), matchAll() search() padStart(), padEnd(), concat(), repeat() split(), slice(), substring(), substr(), trim(), trimStart(), trimEnd() toLowerCase(), toUpperCase(), toLocaleLowerCase(), toLocaleUpperCase(), normalize(), toWellFormed() console.log(
" 1\n\
2",
);
// " 1
// 2"
console.log(` 1
2`);
// " 1
// 2"
const five = 5;
const ten = 10;
console.log(
"Fifteen is " + (five + ten) + " and not " + (2 * five + ten) + ".",
);
// "Fifteen is 15 and not 20."
const five = 5;
const ten = 10;
console.log(`Fifteen is ${five + ten} and not ${2 * five + ten}.`);
// "Fifteen is 15 and not 20."
| Web Proxy Viewer | New URL | Original Page |