| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Guide/Numbers_and_strings | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
JavaScript , . 10, 2, 16 Math .
JavaScript double-precision 64-bit binary format IEEE 754 (, 2^1022 2^+1023 10^308 to 10^+308 53bits ) . 2^53 - 1 .
, : +Infinity, -Infinity, and NaN ( ) .
JavaScript BigInt, . BigInt . , BigInt Number Math BigInt .
JavaScript JavaScript data types and structures .
: 10, 2, 8, 16
1234567890;
42;
// 0 :
0888; // 10 888 .
0777; // non-strict mode 10 511 .
10 (0) . 0 8 , 8 .
2 0 "B"(0B 0b) . 0b 0 1 SyntaxError . "0b 2 "("Missing binary digits after 0b").
var FLT_SIGNBIT = 0b10000000000000000000000000000000; // 2147483648
var FLT_EXPONENT = 0b01111111100000000000000000000000; // 2139095040
var FLT_MANTISSA = 0b00000000011111111111111111111111; // 8388607
8 0 . 0 0 7 , 10 .
var n = 0755; // 493
var m = 0644; // 420
ECMAScript 5 Strict 8 . 8 ECMAScript 5 , 0644 === 420 "\ 045"=== "%" 8 . ECMAScript 2015 0o 8 ( :
var a = 0o10; // ES2015: 8
16 0 "X"(0x 0X) . 0X (0123456789ABCDEF) , SyntaxError : " ".
0xfffffffffffffffff; // 295147905179352830000
0x123456789abcdef; // 81985529216486900
0xa; // 10
1E3 // 1000 2e6 // 2000000 0.1e2 // 10
Number Number , not-a-number, . :
var biggestNum = Number.MAX_VALUE;
var smallestNum = Number.MIN_VALUE;
var infiniteNum = Number.POSITIVE_INFINITY;
var negInfiniteNum = Number.NEGATIVE_INFINITY;
var 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 |
Number.(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() |
.
|
Number.parseInt() |
, .
parseInt() .
|
Number.isFinite() |
. |
Number.isInteger() |
. |
Number.isNaN() |
Not-a-Number
.
(isNaN)
.
|
Number.isSafeInteger() |
. |
Number Number . Number.prototype .
| Description | |
|---|---|
toExponential() |
. |
toFixed() |
. |
toPrecision() |
. |
Math Math . , Math PI pi (3.141 ...) . .
Math.PI;
Math . , , . sine .
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() |
0 . |
clz32(),imul()
|
32 . C-like 32 . |
Math . Math .
Date JavaScript . , Date . Date , . (properties) .
JavaScript . 1970 1 1 00:00:00 . 1970 1 1 00:00:00 .
Date UTC 1970 1 1 -100,000,000 100,000,000 .
Date :
var dateObjectName = new Date([parameters]);
dateObjectName Date . .
new Date .
parameters .
today = new Date();.var Xmas95 = new Date("December 25, 1995 13:30:00"). , , , 0 .var Xmas95 = new Date(1995, 11, 25).var Xmas95 = new Date(1995, 11, 25, 9, 30, 0);.Data Date :
Date parse UTC ."get" "set" , ,, , , . () , getDay , setDay . .
, :
var Xmas95 = new Date("December 25, 1995");
Xmas95.getMonth() 11 , Xmas95.getFullYear() 1995 .
getTime setTime . getTime Date 1970 1 1 00:00 .
, :
var today = new Date();
var endYear = new Date(1995, 11, 31, 23, 59, 59, 999); // Set day and month
endYear.setFullYear(today.getFullYear()); // Set year to this year
var msPerDay = 24 * 60 * 60 * 1000; // Number of milliseconds per day
var daysLeft = (endYear.getTime() - today.getTime()) / msPerDay;
var daysLeft = Math.round(daysLeft); //returns days left in the year
today Date . endYear Date . getTime today endYear .
Parse Date . , IPOdate parse setTime ;
var IPOdate = new Date();
IPOdate.setTime(Date.parse("Aug 9, 1995"));
JSClock() digital .
function JSClock() {
var time = new Date();
var hour = time.getHours();
var minute = time.getMinutes();
var second = time.getSeconds();
var temp = "" + (hour > 12 ? hour - 12 : hour);
if (hour == 0) temp = "12";
temp += (minute < 10 ? ":0" : ":") + minute;
temp += (second < 10 ? ":0" : ":") + second;
temp += hour >= 12 ? " P.M." : " A.M.";
return temp;
}
JSClock time Date . . getHours, getMinutes getSeconds , hour, minute, second .
. temp . hour 12 (hour - 12), 0 12 12.
temp minute . (minute) 10 0 . . temp .
"P.M." . (hour) 12 (temp); "A.M." temp .
This page was last modified on 2026 7 15 by MDN contributors.
Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |