String

번역이 완료되지 않았습니다. Please help translate this article from English

String 전역 객체는 문자열(문자의 나열)의 생성자입니다.

구문

문자열 리터럴은 다음과 같은 형식을 사용합니다.

'string text'
"string text"
"中文 español Deutsch English देवनागरी العربية português বাংলা русский 日本語 norsk bokmål ਪੰਜਾਬੀ 한국어 தமிழ் עברית"

문자열은 String 전역 객체를 직접 사용하여 생성할 수 있습니다.

String(thing)

매개변수

thing
문자열로 변환할 아무 값.

템플릿 리터럴

ECMAScript 2015 이후, 문자열 리터럴은 소위 템플릿 리터럴이 될 수 있습니다.

`hello world` `hello! world!` `hello ${who}` tag `<a>${who}</a>`

이스케이프 표현

일반적인 출력 문자 외의 특수 문자는 이스케이프 표현을 사용해 적을 수 있습니다.

코드 출력
\XXX 8진수 Latin-1 문자
\' 작은따옴표
\" 큰따옴표
\\ 역슬래시
\n 개행
\r 캐리지 리턴
\v 세로 탭
\t
\b 백 스페이스
\f 폼 피드
\uXXXX 유니코드 코드포인트
\u{X} ... \u{XXXXXX} 유니코드 코드포인트
\xXX Latin-1 문자

일부 다른 프로그래밍 언어와 달리, JavaScript는 작은따옴표와 큰따옴표 문자열을 구분하지 않습니다. 따라서 위의 이스케이프 문자는 작은따옴표나 큰따옴표에서 상관 없이 작동합니다.

긴 문자열 리터럴

작성한 코드가 매우 긴 문자열을 포함해야 하는 경우, 끝 없이 뻗어나가는 한 줄이나 편집기의 재량에 따라 자동으로 줄을 넘기는 대신 직접 여러 줄로 나누되 내용에는 영향을 주지 않고 싶을 때가 있을겁니다. 이런 상황에는 두 가지 방법을 사용할 수 있습니다.

우선 다음과 같이 + 연산자를 사용할 수 있습니다.

let longString = "여러 줄에 걸쳐 작성해야 할 정도로 " +
                 "긴 문자열인데 왜 한 줄에 다 적으면 안되냐면 " +
                 "코드를 읽기 힘들어지니까요.";

아니면 역슬래시 문자("\")를 각 줄의 맨 끝에 붙여 문자열이 이어진다는걸 표시할 수도 있습니다. 역슬래시 다음에 공백을 포함한 어떤 문자라도 붙으면 제대로 작동하지 않으므로 주의해야 합니다.

let longString = "여러 줄에 걸쳐 작성해야 할 정도로 \
긴 문자열인데 왜 한 줄에 다 적으면 안되냐면 \
코드를 읽기 힘들어지니까요.";

두 예시 모두 동일한 문자열을 생성합니다.

설명

문자열은 텍스트 형태로 표현될 수있는 데이터를 보관하는 데 유용합니다. 문자열에서 가장 많이 사용되는 작업들은 문자열의 길이를 확인하는 (length), 문자열을 생성하고 연결하는 + 와 += 문자열 연산자, 서브문자열(substring)이 있는지 확인하고, 있으면 위치를 확인하는 indexOf() 메서드, 서브문자열(substring)을 추출해내는 substring() 메서드가 있습니다.

문자 접근

문자열에서 개개의 문자에 접근할 수 있는 방법은 두가지가 있습니다. 첫번째는 charAt() 메서드를 이용하는 것입니다:

return 'cat'.charAt(1); // returns "a"

다른 방법(ECMAScript 5에서 소개하고 있는)은 문자열을 배열과 같은 오브젝트로 취급하여, 문자에 해당하는 숫자 인덱스를 사용하는 방법입니다 :

return 'cat'[1]; // returns "a"

브라켓([ ]) 표기법을 사용하여 문자에 접근하는 경우 , 이러한 프로퍼티들에 새로운 값을 할당하거나 삭제할 수는 없습니다. 포함되어 있는 프로퍼티들은 작성할 수도, 수정할 수도 없습니다. (더 자세한 정보는 Object.defineProperty()를 참고 바랍니다 .)

문자열 비교

C 개발자는 문자열 비교를 위하여 strcmp() 함수를 사용합니다. JavaScript에서는 단지 less-than와 greater-than 연산자만을 사용하여 문자열을 비교할 수 있습니다 :

var a = "a";
var b = "b";
if (a < b) { // true
  console.log(a + " is less than " + b);
} else if (a > b) {
  console.log(a + " is greater than " + b);
} else {
  console.log(a + " and " + b + " are equal.");
}

비슷한 결과를 얻을 수 있는 방법으로 String 인스턴스에서 상속된 localeCompare() 메서드를 사용할 수 있습니다.

문자열 원형과 String 객체의 차이

JavaScript는 String 오브젝트와 원형의 문자열을 다르게 취급한다는 것에 주의해야 합니다. (Boolean숫자의 true도 마찬가지입니다.)
 

문자열 리터럴(작은 따옴표 또는 큰 따옴표로 생성되는)과 생성자 없이(즉. new 키워드를 사용하지 않고) String을 호출하여 반환된 문자열은 원형 문자열(primitive strings)입니다. JavaScript는 자동적으로 원형을 String 오브젝트로 변환하기 때문에, String 오브젝트 메서드를 사용하여 원형문자열을 생성할 수 있습니다. 문맥 안의 메서드에서 프로퍼티 조회 또는 원형의 문자열 호출이 발생하면, JavaScript는 자동으로 문자열 원형을 감싸고 프로퍼티 조회를 수행 하거나 메서드를 호출합니다.

var s_prim = "foo";
var s_obj = new String(s_prim);

console.log(typeof s_prim); // Logs "string"
console.log(typeof s_obj);  // Logs "object"

문자열 원형과 String 오브젝트는 eval()을 사용할 때 다른 결과를 제공합니다. eval에 전달되는 문자열 원형들은 소스 코드 취급을 받습니다; String 오브젝트들은 다른 모든 오브젝트들과 마찬가지로 취급하며, 오브젝트를 반환합니다. 예를 들면:

var s1 = '2 + 2';               // creates a string primitive
var s2 = new String('2 + 2');   // creates a String object
console.log(eval(s1));          // returns the number 4
console.log(eval(s2));          // returns the string "2 + 2"

이러한 이유로, 비록 코드 상에서 원형 문자열을 사용하는 대신에 String 오브젝트를 사용하게 되면 코드가 손상될 수 있지만, 일반적인 개발자는 차이를 걱정할 필요는 없습니다.

String 오프젝트는 언제든지 valueOf() 메서드로 원형에 대응하도록 전환할 수 있습니다.

console.log(eval(s2.valueOf())); // returns the number 4

속성

String.prototype
String 오브젝트는 프로퍼티의 추가가 가능합니다.

메서드

String.fromCharCode()
지정된 유니코 값의 순서를 이용하여 만든 문자열을 반환합니다.
String.fromCodePoint()
지정된 코드 포인트 순서를 이용하여 만든 문자열을 반환합니다.
String.raw()
원형 템플릿 문자열(raw template string)에서 생성된 문자열을 반환합니다.

String generic 메서드

String generic들은 비표준으로, 가까운 미래에 사라질 것입니다. 아래에서 제공하고 있는 방식을 사용하지 않으면, 브라우저들간의 호환성은 기대하기 어렵습니다. 

String 인스턴스 메서드는 JavScript 1.6으로 Firefox에서(ECMAScript 표준에 속하지는 않지만) 어떤 오브젝트라도 String 메서드에 적용하여 String 오브젝트에서 사용가능합니다:

var num = 15;
console.log(String.replace(num, /5/, '2'));

Generics Array 메서드에도 사용 가능합니다.

String 인스턴스

속성

String.prototype.constructor
오브젝트의 프로토타입을 생성하는 함수를 명세합니다.
String.prototype.length
문자열의 길이를 반영합니다.
N
N번째 위치에 있는 문자에 접근하기 위해 사용합니다.  N 은 0과 length보다 작은 값 사이에 있는 양의 정수입니다. 이 퍼라퍼티들은 읽기 전용(read-only) 속성을 가지고 있습니다. 

메서드

HTML과 관계없는 메서드

HTML wrapper methods

예제

문자열 변환

비록 일반적으로 toString() 함수를 많이 사용하고 있지만, toString()의 "안전한" 대안으로 String을 사용할 수 있습니다. String은 null과 undefined에 대해서도 잘 동작합니다. 예를 들면: 

var outputStrings = [];
for (var i = 0, n = inputValues.length; i < n; ++i) {
  outputStrings.push(String(inputValues[i]));
}

명세

Specification Status Comment
ECMAScript 1st Edition (ECMA-262) Standard Initial definition.
ECMAScript 5.1 (ECMA-262)
The definition of 'String' in that specification.
Standard  
ECMAScript 2015 (6th Edition, ECMA-262)
The definition of 'String' in that specification.
Standard  
ECMAScript (ECMA-262)
The definition of 'String' in that specification.
Living Standard  

브라우저 호환성

Update compatibility data on GitHub
DesktopMobileServer
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.js
StringChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
String() constructorChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
anchor
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1
Notes
Full support 1
Notes
Notes Starting with version 17, the quotation mark (") is replaced by its HTML reference character (") in strings supplied for the name parameter.
IE No support NoOpera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
big
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
blink
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
bold
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
charAtChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
charCodeAtChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support 4Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
codePointAtChrome Full support 41Edge Full support 12Firefox Full support 29IE No support NoOpera Full support 28Safari Full support 10WebView Android Full support 41Chrome Android Full support 41Firefox Android Full support 29Opera Android Full support 28Safari iOS Full support 10Samsung Internet Android Full support 4.0nodejs Full support 4.0.0
Full support 4.0.0
Full support 0.12
Disabled
Disabled From version 0.12: this feature is behind the --harmony runtime flag.
concatChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support 4Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
endsWithChrome Full support 41Edge Full support 12Firefox Full support 17IE No support NoOpera Full support 28Safari Full support 9WebView Android Full support ≤37Chrome Android Full support 36Firefox Android Full support 17Opera Android Full support 24Safari iOS Full support 9Samsung Internet Android Full support 3.0nodejs Full support 4.0.0
Full support 4.0.0
Full support 0.12
Disabled
Disabled From version 0.12: this feature is behind the --harmony runtime flag.
fixed
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
fontcolor
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
fontsize
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
fromCharCodeChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support 4Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
fromCodePointChrome Full support 41Edge Full support 12Firefox Full support 29IE No support NoOpera Full support 28Safari Full support 10WebView Android Full support 41Chrome Android Full support 41Firefox Android Full support 29Opera Android Full support 28Safari iOS Full support 10Samsung Internet Android Full support 4.0nodejs Full support 4.0.0
Full support 4.0.0
Full support 0.12
Disabled
Disabled From version 0.12: this feature is behind the --harmony runtime flag.
includesChrome Full support 41Edge Full support 12Firefox Full support 40
Full support 40
No support 18 — 48
Alternate Name
Alternate Name Uses the non-standard name: contains
IE No support NoOpera Full support 28Safari Full support 9WebView Android Full support 41Chrome Android Full support 41Firefox Android Full support 40
Full support 40
No support 18 — 48
Alternate Name
Alternate Name Uses the non-standard name: contains
Opera Android Full support 28Safari iOS Full support 9Samsung Internet Android Full support 4.0nodejs Full support 4.0.0
indexOfChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
italics
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
lastIndexOfChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 6Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
lengthChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
link
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
localeCompareChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 5.5Opera Full support 7Safari Full support 3WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
localeCompare.localesChrome Full support 24Edge Full support 12Firefox Full support 29IE Full support 11Opera Full support 15Safari Full support 10WebView Android No support NoChrome Android Full support 26Firefox Android No support NoOpera Android No support NoSafari iOS Full support 10Samsung Internet Android Full support 1.5nodejs Full support 13.0.0
Full support 13.0.0
Partial support 0.12
Notes
Notes Before version 13.0.0, only the locale data for en-US is available by default. When other locales are specified, the function silently falls back to en-US. To make full ICU (locale) data available for versions prior to 13, see Node.js documentation on the --with-intl option and how to provide the data.
localeCompare.optionsChrome Full support 24Edge Full support 12Firefox Full support 29IE Full support 11Opera Full support 15Safari Full support 10WebView Android No support NoChrome Android Full support 26Firefox Android No support NoOpera Android No support NoSafari iOS Full support 10Samsung Internet Android Full support 1.5nodejs Full support 0.12
matchChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support 4Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
matchAllChrome Full support 73Edge Full support 79Firefox Full support 67IE No support NoOpera Full support 60Safari Full support 13WebView Android Full support 73Chrome Android Full support 73Firefox Android Full support 67Opera Android Full support 52Safari iOS Full support 13Samsung Internet Android No support Nonodejs Full support 12.0.0
normalizeChrome Full support 34Edge Full support 12Firefox Full support 31IE No support NoOpera Full support 21Safari Full support 10WebView Android No support NoChrome Android Full support 34Firefox Android Full support 31Opera Android Full support 21Safari iOS Full support 10Samsung Internet Android Full support 2.0nodejs Full support 0.12
padEndChrome Full support 57Edge Full support 15Firefox Full support 48IE No support NoOpera Full support 44Safari Full support 10WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 48Opera Android Full support 43Safari iOS Full support 10Samsung Internet Android Full support 7.0nodejs Full support 8.0.0
Full support 8.0.0
Full support 7.0.0
Disabled
Disabled From version 7.0.0: this feature is behind the --harmony runtime flag.
padStartChrome Full support 57Edge Full support 15Firefox Full support 48IE No support NoOpera Full support 44Safari Full support 10WebView Android Full support 57Chrome Android Full support 57Firefox Android Full support 48Opera Android Full support 43Safari iOS Full support 10Samsung Internet Android Full support 7.0nodejs Full support 8.0.0
Full support 8.0.0
Full support 7.0.0
Disabled
Disabled From version 7.0.0: this feature is behind the --harmony runtime flag.
rawChrome Full support 41Edge Full support 12Firefox Full support 34IE No support NoOpera No support NoSafari Full support 10WebView Android No support NoChrome Android Full support 41Firefox Android Full support 34Opera Android No support NoSafari iOS Full support 10Samsung Internet Android Full support 4.0nodejs Full support 4.0.0
repeatChrome Full support 41Edge Full support 12Firefox Full support 24IE No support NoOpera Full support 28Safari Full support 9WebView Android No support NoChrome Android Full support 36Firefox Android Full support 24Opera Android Full support 28Safari iOS Full support 9Samsung Internet Android Full support 3.0nodejs Full support 4.0.0
Full support 4.0.0
Full support 0.12
Disabled
Disabled From version 0.12: this feature is behind the --harmony runtime flag.
replaceChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support 4Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
replaceAllChrome Full support 85Edge Full support 85Firefox Full support 77IE No support NoOpera Full support 71Safari Full support 13.1WebView Android Full support 85Chrome Android Full support 85Firefox Android Full support 79Opera Android Full support 60Safari iOS Full support 13.4Samsung Internet Android No support Nonodejs No support No
searchChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support 4Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
search.flags
DeprecatedNon-standard
Chrome No support NoEdge No support NoFirefox No support 1 — 49IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android No support 4 — 49Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs No support No
sliceChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support 4Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
small
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
splitChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
startsWithChrome Full support 41Edge Full support 12Firefox Full support 17IE No support NoOpera Full support 28Safari Full support 9WebView Android Full support ≤37Chrome Android Full support 36Firefox Android Full support 17Opera Android Full support 24Safari iOS Full support 9Samsung Internet Android Full support 3.0nodejs Full support 4.0.0
Full support 4.0.0
Full support 0.12
Disabled
Disabled From version 0.12: this feature is behind the --harmony runtime flag.
strike
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
sub
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
substr
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support 4Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
substringChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
sup
Deprecated
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
toLocaleLowerCaseChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 5.5Opera Full support 4Safari Full support 1.3WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
toLocaleLowerCase.localeChrome Full support 58Edge Full support 12Firefox Full support 55IE Full support 6Opera Full support 45Safari Full support 10WebView Android Full support 58Chrome Android Full support 58Firefox Android Full support 55Opera Android Full support 43Safari iOS Full support 10Samsung Internet Android Full support 7.0nodejs Full support 13.0.0
Full support 13.0.0
Partial support 0.12
Notes
Notes Before version 13.0.0, only the locale data for en-US is available by default. When other locales are specified, the function silently falls back to en-US. To make full ICU (locale) data available for versions prior to 13, see Node.js documentation on the --with-intl option and how to provide the data.
toLocaleUpperCaseChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 5.5Opera Full support 4Safari Full support 1.3WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
toLocaleUpperCase.localeChrome Full support 58Edge Full support 12Firefox Full support 55IE Full support 6Opera Full support 45Safari Full support 10WebView Android Full support 58Chrome Android Full support 58Firefox Android Full support 55Opera Android Full support 42Safari iOS Full support 10Samsung Internet Android Full support 7.0nodejs Full support 13.0.0
Full support 13.0.0
Partial support 0.12
Notes
Notes Before version 13.0.0, only the locale data for en-US is available by default. When other locales are specified, the function silently falls back to en-US. To make full ICU (locale) data available for versions prior to 13, see Node.js documentation on the --with-intl option and how to provide the data.
toLowerCaseChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
toSource
Non-standard
Chrome No support NoEdge No support NoFirefox No support 1 — 74
Notes
No support 1 — 74
Notes
Notes Starting in Firefox 74, toSource() is no longer available for use by web content. It is still allowed for internal and privileged code.
IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android Full support 4Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs No support No
toStringChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
toUpperCaseChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 3Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
trimChrome Full support 4Edge Full support 12Firefox Full support 3.5IE Full support 9Opera Full support 10.5Safari Full support 5WebView Android Full support ≤37Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 11Safari iOS Full support 5Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
trimEndChrome Full support 66
Full support 66
Full support 4
Alternate Name
Alternate Name Uses the non-standard name: trimRight
Edge Full support 12
Alternate Name
Full support 12
Alternate Name
Alternate Name Uses the non-standard name: trimRight
Firefox Full support 61
Full support 61
Full support 3.5
Alternate Name
Alternate Name Uses the non-standard name: trimRight
IE No support NoOpera Full support 53
Full support 53
Full support 15
Alternate Name
Alternate Name Uses the non-standard name: trimRight
Safari Full support 12WebView Android Full support 66
Full support 66
Full support ≤37
Alternate Name
Alternate Name Uses the non-standard name: trimRight
Chrome Android Full support 66
Full support 66
Full support 18
Alternate Name
Alternate Name Uses the non-standard name: trimRight
Firefox Android Full support 61
Full support 61
Full support 4
Alternate Name
Alternate Name Uses the non-standard name: trimRight
Opera Android Full support 47
Full support 47
Full support 14
Alternate Name
Alternate Name Uses the non-standard name: trimRight
Safari iOS Full support 12Samsung Internet Android Full support 9.0
Full support 9.0
Full support 1.0
Alternate Name
Alternate Name Uses the non-standard name: trimRight
nodejs Full support 10.0.0
Full support 10.0.0
Full support 0.12
Alternate Name
Alternate Name Uses the non-standard name: trimRight
trimStartChrome Full support 66
Full support 66
Full support 4
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Edge Full support 12
Alternate Name
Full support 12
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Firefox Full support 61
Full support 61
Full support 3.5
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
IE No support NoOpera Full support 53
Full support 53
Full support 15
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Safari Full support 12WebView Android Full support 66
Full support 66
Full support ≤37
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Chrome Android Full support 66
Full support 66
Full support 18
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Firefox Android Full support 61
Full support 61
Full support 4
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Opera Android Full support 47
Full support 47
Full support 14
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Safari iOS Full support 12Samsung Internet Android Full support 9.0
Full support 9.0
Full support 1.0
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
nodejs Full support 10.0.0
Full support 10.0.0
Full support 0.12
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Unicode code point escapes \u{xxxxxx}Chrome Full support 1Edge Full support 12Firefox Full support 40IE Full support 4Opera Full support 4Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 40Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
valueOfChrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 4Opera Full support 3Safari Full support 1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support 1Samsung Internet Android Full support 1.0nodejs Full support 0.1.100
@@iteratorChrome Full support 38Edge Full support 12Firefox Full support 36
Full support 36
No support 27 — 36
Notes Alternate Name
Notes A placeholder property named @@iterator is used.
Alternate Name Uses the non-standard name: @@iterator
No support 17 — 27
Notes Alternate Name
Notes A placeholder property named iterator is used.
Alternate Name Uses the non-standard name: iterator
IE No support NoOpera Full support 25Safari Full support 9WebView Android Full support 38Chrome Android Full support 38Firefox Android Full support 36
Full support 36
No support 27 — 36
Notes Alternate Name
Notes A placeholder property named @@iterator is used.
Alternate Name Uses the non-standard name: @@iterator
No support 17 — 27
Notes Alternate Name
Notes A placeholder property named iterator is used.
Alternate Name Uses the non-standard name: iterator
Opera Android Full support 25Safari iOS Full support 9Samsung Internet Android Full support 3.0nodejs Full support 0.12

Legend

Full support  
Full support
No support  
No support
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.
See implementation notes.
See implementation notes.
User must explicitly enable this feature.
User must explicitly enable this feature.
Uses a non-standard name.
Uses a non-standard name.

같이 보기