현재 번역은 완벽하지 않습니다. 한국어로 문서 번역에 동참해주세요.
This is a new technology, part of the ECMAScript 2015 (ES6) standard.
This technology's specification has been finalized, but check the compatibility table for usage and implementation status in various browsers.
Number.parseInt()
함수는 문자열 인수를 형변환하여 지정된 진법이나 기본 타입으로 리턴합니다.
Number.parseInt(string[, radix])
Parameters
string
- The value to parse. If
string
is not a string, then it is converted to one. Leading whitespace in the string is ignored.
radix
- An integer between 2 and 36 that represents the radix (the base in mathematical numeral systems) of the above mentioned string. Specify
10
for the decimal numeral system commonly used by humans. Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior. Different implementations produce different results when a radix is not specified.
Description
이 함수는 전역 함수인parseInt()
함수와 완벽하게 같은 함수입니다 :
Number.parseInt === parseInt; // true
또한 ECMAScript 6의 일부분으로 전역 모듈화를 목적으로 동작합니다. 더 자세한 예제를 보기 위해서는 parseInt()
를 보시기 바랍니다.
Polyfill
Number.parseInt = parseInt;
Specifications
Specification | Status | Comment |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Number.parseInt' in that specification. |
Standard | Initial definition. |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | (Yes) | 25 (25) | Not supported | (Yes) | Not supported |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | Not supported | 25 (25) | Not supported | Not supported | Not supported |
See also
- The
Number
object it belongs to. - The global
parseInt()
method.