이 번역은 완료되지 않았습니다. 이 문서를 번역해 주세요.

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과 관계없는 메서드

String.prototype.charAt()
Returns the character (exactly one UTF-16 code unit) at the specified index.
String.prototype.charCodeAt()
Returns a number that is the UTF-16 code unit value at the given index.
String.prototype.codePointAt()
Returns a nonnegative integer Number that is the code point value of the UTF-16 encoded code point starting at the specified index.
String.prototype.concat()
Combines the text of two strings and returns a new string.
String.prototype.includes()
Determines whether one string may be found within another string.
String.prototype.endsWith()
Determines whether a string ends with the characters of another string.
String.prototype.indexOf()
Returns the index within the calling String object of the first occurrence of the specified value, or -1 if not found.
String.prototype.lastIndexOf()
Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found.
String.prototype.localeCompare()
Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order.
String.prototype.match()
Used to match a regular expression against a string.
String.prototype.matchAll()
Returns an iterator of all matches.
String.prototype.normalize()
Returns the Unicode Normalization Form of the calling string value.
String.prototype.padEnd()
Pads the current string from the end with a given string to create a new string from a given length.
String.prototype.padStart()
Pads the current string from the start with a given string to create a new string from a given length.
String.prototype.quote()
Wraps the string in double quotes (""").
String.prototype.repeat()
Returns a string consisting of the elements of the object repeated the given times.
String.prototype.replace()
Used to find a match between a regular expression and a string, and to replace the matched substring with a new substring.
String.prototype.search()
Executes the search for a match between a regular expression and a specified string.
String.prototype.slice()
Extracts a section of a string and returns a new string.
String.prototype.split()
Splits a String object into an array of strings by separating the string into substrings.
String.prototype.startsWith()
Determines whether a string begins with the characters of another string.
String.prototype.substr()
Returns the characters in a string beginning at the specified location through the specified number of characters.
String.prototype.substring()
Returns the characters in a string between two indexes into the string.
String.prototype.toLocaleLowerCase()
The characters within a string are converted to lower case while respecting the current locale. For most languages, this will return the same as toLowerCase().
String.prototype.toLocaleUpperCase()
The characters within a string are converted to upper case while respecting the current locale. For most languages, this will return the same as toUpperCase().
String.prototype.toLowerCase()
Returns the calling string value converted to lower case.
String.prototype.toSource()
Returns an object literal representing the specified object; you can use this value to create a new object. Overrides the Object.prototype.toSource() method.
String.prototype.toString()
Returns a string representing the specified object. Overrides the Object.prototype.toString() method.
String.prototype.toUpperCase()
Returns the calling string value converted to uppercase.
String.prototype.trim()
Trims whitespace from the beginning and end of the string. Part of the ECMAScript 5 standard.
String.prototype.trimStart()
String.prototype.trimLeft()
Trims whitespace from the beginning of the string.
String.prototype.trimEnd()
String.prototype.trimRight()
Trims whitespace from the end of the string.
String.prototype.valueOf()
Returns the primitive value of the specified object. Overrides the Object.prototype.valueOf() method.
String.prototype[@@iterator]()
Returns a new Iterator object that iterates over the code points of a String value, returning each code point as a String value.

HTML wrapper methods

These methods are of limited use, as they provide only a subset of the available HTML tags and attributes.

String.prototype.anchor()
<a name="name"> (hypertext target)
String.prototype.big()
<big>
String.prototype.blink()
<blink>
String.prototype.bold()
<b>
String.prototype.fixed()
<tt>
String.prototype.fontcolor()
<font color="color">
String.prototype.fontsize()
<font size="size">
String.prototype.italics()
<i>
String.prototype.link()
<a href="url"> (link to URL)
String.prototype.small()
<small>
String.prototype.strike()
<strike>
String.prototype.sub()
<sub>
String.prototype.sup()
<sup>

예제

문자열 변환

비록 일반적으로 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 Latest Draft (ECMA-262)
The definition of 'String' in that specification.
Draft  

브라우저 호환성

Update compatibility data on GitHub
DesktopMobileServer
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.js
StringChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
@@iteratorChrome Full support YesEdge Full support YesFirefox 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 No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile ? Firefox 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 No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs Full support 0.12
Unicode code point escapes \u{xxxxxx}Chrome Full support YesEdge ? Firefox Full support 40IE ? Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android Full support 40Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
anchor
Deprecated
Chrome Full support YesEdge 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 YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
big
Deprecated
Chrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
blink
Deprecated
Chrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
bold
Deprecated
Chrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
charAtChrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
charCodeAtChrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
codePointAtChrome Full support 41Edge Full support 12Firefox Full support 29IE No support NoOpera Full support 28Safari Full support 10WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 29Opera Android Full support YesSafari iOS Full support 10Samsung Internet Android Full support Yesnodejs 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 YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
endsWithChrome Full support 41Edge Full support 12Firefox Full support 17IE No support NoOpera Full support 28Safari Full support 9WebView Android Full support YesChrome Android Full support 36Edge Mobile Full support YesFirefox Android Full support 17Opera Android Full support YesSafari iOS Full support 9Samsung Internet Android Full support Yesnodejs 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 YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
fontcolor
Deprecated
Chrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
fontsize
Deprecated
Chrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
fromCharCodeChrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
fromCodePointChrome Full support 41Edge Full support 12Firefox Full support 29IE No support NoOpera Full support 28Safari Full support 10WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 29Opera Android Full support YesSafari iOS Full support 10Samsung Internet Android Full support Yesnodejs 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 YesSafari Full support 9WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox 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 YesSafari iOS Full support 9Samsung Internet Android Full support Yesnodejs Full support 4.0.0
indexOfChrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
italics
Deprecated
Chrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
lastIndexOfChrome Full support YesEdge Full support 12Firefox Full support 1IE Full support 6Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
lengthChrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
link
Deprecated
Chrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
localeCompareChrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
localeCompare.localesChrome Full support 24Edge Full support YesFirefox Full support 29IE Full support 11Opera Full support 15Safari Full support 10WebView Android No support NoChrome Android Full support 26Edge Mobile ? Firefox Android No support NoOpera Android No support NoSafari iOS Full support 10Samsung Internet Android Full support Yesnodejs ?
localeCompare.optionsChrome Full support 24Edge Full support YesFirefox Full support 29IE Full support 11Opera Full support 15Safari Full support 10WebView Android No support NoChrome Android Full support 26Edge Mobile ? Firefox Android No support NoOpera Android No support NoSafari iOS Full support 10Samsung Internet Android Full support Yesnodejs ?
matchChrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
match.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 NoEdge Mobile No support NoFirefox Android No support 4 — 49Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs No support No
matchAllChrome Full support 73Edge No support NoFirefox Full support 67IE No support NoOpera Full support 60Safari No support NoWebView Android Full support 73Chrome Android Full support 73Edge Mobile No support NoFirefox Android Full support 67Opera Android Full support YesSafari iOS No support NoSamsung Internet Android Full support Yesnodejs No support No
normalizeChrome Full support 34Edge Full support 12Firefox Full support 31IE No support NoOpera Full support YesSafari Full support 10WebView Android No support NoChrome Android Full support 34Edge Mobile Full support YesFirefox Android Full support 31Opera Android Full support YesSafari iOS Full support 10Samsung Internet Android Full support Yesnodejs 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 57Edge Mobile Full support YesFirefox 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 57Edge Mobile Full support YesFirefox 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.
prototypeChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
quote
Deprecated
Chrome No support NoEdge No support NoFirefox No support 1 — 37IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile No support NoFirefox Android No support 4 — 37Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs No support No
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 41Edge Mobile Full support YesFirefox 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 YesSafari Full support 9WebView Android No support NoChrome Android Full support 36Edge Mobile Full support YesFirefox Android Full support 24Opera Android Full support YesSafari iOS Full support 9Samsung Internet Android Full support Yesnodejs 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 YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
replace.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 NoEdge Mobile No support NoFirefox Android No support 4 — 49Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support Nonodejs No support No
searchChrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
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 NoEdge Mobile 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 YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
small
Deprecated
Chrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
splitChrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
startsWithChrome Full support 41Edge Full support 12Firefox Full support 17IE No support NoOpera Full support 28Safari Full support 9WebView Android Full support YesChrome Android Full support 36Edge Mobile Full support YesFirefox Android Full support 17Opera Android Full support YesSafari iOS Full support 9Samsung Internet Android Full support Yesnodejs 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 YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
sub
Deprecated
Chrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
substr
Deprecated
Chrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
substringChrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
sup
Deprecated
Chrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
toLocaleLowerCaseChrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
toLocaleLowerCase.localeChrome ? Edge ? Firefox Full support 55IE ? Opera ? Safari ? WebView Android ? Chrome Android ? Edge Mobile ? Firefox Android Full support 55Opera Android ? Safari iOS ? Samsung Internet Android ? nodejs ?
toLocaleUpperCaseChrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
toLocaleUpperCase.localeChrome ? Edge ? Firefox Full support 55IE ? Opera ? Safari ? WebView Android ? Chrome Android ? Edge Mobile ? Firefox Android Full support 55Opera Android ? Safari iOS ? Samsung Internet Android ? nodejs ?
toLowerCaseChrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
toSource
Non-standard
Chrome No support NoEdge No support NoFirefox Full support 1IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile 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 YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
toUpperCaseChrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
trimChrome Full support YesEdge Full support 12Firefox Full support 3.5IE Full support 9Opera Full support 10.5Safari Full support 5WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes
trimEndChrome Full support 66
Full support 66
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: trimRight
Edge ? 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 53Safari ? WebView Android Full support 66
Full support 66
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: trimRight
Chrome Android Full support 66
Full support 66
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: trimRight
Edge Mobile ? 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 47Safari iOS ? Samsung Internet Android Full support Yes
Full support Yes
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: trimRight
nodejs Full support 10.0.0
trimStartChrome Full support 66
Full support 66
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Edge ? 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 53Safari ? WebView Android Full support 66
Full support 66
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Chrome Android Full support 66
Full support 66
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
Edge Mobile ? 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 47Safari iOS ? Samsung Internet Android Full support Yes
Full support Yes
Full support Yes
Alternate Name
Alternate Name Uses the non-standard name: trimLeft
nodejs Full support 10.0.0
valueOfChrome Full support YesEdge Full support YesFirefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
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.

같이 보기

문서 태그 및 공헌자

이 페이지의 공헌자: mdnwebdocs-bot, alattalatta, seungha-kim, pusanbear, teoli, MoGi
최종 변경자: mdnwebdocs-bot,