From 85cc97f55eba54af5a1361ddbe068ebe1d02f5a9 Mon Sep 17 00:00:00 2001 From: "Isa(yunjongryu)" Date: Thu, 29 Jul 2021 09:49:21 +0900 Subject: etc: 깃 이력 추적을 위한 절차 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global_objects/string/trimstart/index.html | 106 --------------------- .../global_objects/string/trimstart/index.md | 106 +++++++++++++++++++++ 2 files changed, 106 insertions(+), 106 deletions(-) delete mode 100644 files/ko/web/javascript/reference/global_objects/string/trimstart/index.html create mode 100644 files/ko/web/javascript/reference/global_objects/string/trimstart/index.md diff --git a/files/ko/web/javascript/reference/global_objects/string/trimstart/index.html b/files/ko/web/javascript/reference/global_objects/string/trimstart/index.html deleted file mode 100644 index df264d0078..0000000000 --- a/files/ko/web/javascript/reference/global_objects/string/trimstart/index.html +++ /dev/null @@ -1,106 +0,0 @@ ---- -title: String.prototype.trimStart() -slug: Web/JavaScript/Reference/Global_Objects/String/trimStart -tags: -- JavaScript -- Method -- Prototype -- Reference -- String -- Polyfill -browser-compat: javascript.builtins.String.trimStart -translation_of: Web/JavaScript/Reference/Global_Objects/String/trimStart ---- -
{{JSRef}}
- -

trimStart()메서드는 문자열 시작부분의 공백을 제거합니다. 또한 trimLeft()라는 별칭으로 호출이 가능합니다.

- -
{{EmbedInteractiveExample("pages/js/string-trimstart.html")}}
- - -

구문

- -
-trimStart()
-
-trimLeft()
-
- -

반환값

- -

str시작부분(왼쪽)에서 공백이 제거된 새 문자열을 반환합니다.

- -

str에 공백이 없을시에도 에러가 발생하지 않고 여전히 새 문자열(본질적으로 str의 복사본)이 반환됩니다.

- -

별칭

- -

{{jsxref("String.prototype.padStart")}}표준 메서드 이름과 같은 함수의 일관성을 위해서trimStart가 되었습니다. 그러나, - 웹 호환성을 위해서 trimLeft 이라는 별칭을 가집니다. 일부 엔진에서 이것은 다음 예시를 의미합니다.

- -
String.prototype.trimLeft.name === "trimStart";
- -

예제

- -

trimStart() 사용

- -

다음 예제는'foo '문자열을 표시합니다.

- -
var str = '   foo  ';
-
-console.log(str.length); // 8
-
-str = str.trimStart();
-console.log(str.length); // 5
-console.log(str);        // 'foo  '
-
- -

폴리필

- -
//https://github.com/FabioVergani/js-Polyfill_String-trimStart
-
-(function(w){
-    var String=w.String, Proto=String.prototype;
-
-    (function(o,p){
-        if(p in o?o[p]?false:true:true){
-            var r=/^\s+/;
-            o[p]=o.trimLeft||function(){
-                return this.replace(r,'')
-            }
-        }
-    })(Proto,'trimStart');
-
-})(window);
-
-/*
-ES6:
-(w=>{
-    const String=w.String, Proto=String.prototype;
-
-    ((o,p)=>{
-        if(p in o?o[p]?false:true:true){
-            const r=/^\s+/;
-            o[p]=o.trimLeft||function(){
-                return this.replace(r,'')
-            }
-        }
-    })(Proto,'trimStart');
-
-})(window);
-*/
- -

명세서

- -{{Specifications}} - -

브라우저 호환성

- -

{{Compat}}

- -

같이 보기

- - diff --git a/files/ko/web/javascript/reference/global_objects/string/trimstart/index.md b/files/ko/web/javascript/reference/global_objects/string/trimstart/index.md new file mode 100644 index 0000000000..df264d0078 --- /dev/null +++ b/files/ko/web/javascript/reference/global_objects/string/trimstart/index.md @@ -0,0 +1,106 @@ +--- +title: String.prototype.trimStart() +slug: Web/JavaScript/Reference/Global_Objects/String/trimStart +tags: +- JavaScript +- Method +- Prototype +- Reference +- String +- Polyfill +browser-compat: javascript.builtins.String.trimStart +translation_of: Web/JavaScript/Reference/Global_Objects/String/trimStart +--- +
{{JSRef}}
+ +

trimStart()메서드는 문자열 시작부분의 공백을 제거합니다. 또한 trimLeft()라는 별칭으로 호출이 가능합니다.

+ +
{{EmbedInteractiveExample("pages/js/string-trimstart.html")}}
+ + +

구문

+ +
+trimStart()
+
+trimLeft()
+
+ +

반환값

+ +

str시작부분(왼쪽)에서 공백이 제거된 새 문자열을 반환합니다.

+ +

str에 공백이 없을시에도 에러가 발생하지 않고 여전히 새 문자열(본질적으로 str의 복사본)이 반환됩니다.

+ +

별칭

+ +

{{jsxref("String.prototype.padStart")}}표준 메서드 이름과 같은 함수의 일관성을 위해서trimStart가 되었습니다. 그러나, + 웹 호환성을 위해서 trimLeft 이라는 별칭을 가집니다. 일부 엔진에서 이것은 다음 예시를 의미합니다.

+ +
String.prototype.trimLeft.name === "trimStart";
+ +

예제

+ +

trimStart() 사용

+ +

다음 예제는'foo '문자열을 표시합니다.

+ +
var str = '   foo  ';
+
+console.log(str.length); // 8
+
+str = str.trimStart();
+console.log(str.length); // 5
+console.log(str);        // 'foo  '
+
+ +

폴리필

+ +
//https://github.com/FabioVergani/js-Polyfill_String-trimStart
+
+(function(w){
+    var String=w.String, Proto=String.prototype;
+
+    (function(o,p){
+        if(p in o?o[p]?false:true:true){
+            var r=/^\s+/;
+            o[p]=o.trimLeft||function(){
+                return this.replace(r,'')
+            }
+        }
+    })(Proto,'trimStart');
+
+})(window);
+
+/*
+ES6:
+(w=>{
+    const String=w.String, Proto=String.prototype;
+
+    ((o,p)=>{
+        if(p in o?o[p]?false:true:true){
+            const r=/^\s+/;
+            o[p]=o.trimLeft||function(){
+                return this.replace(r,'')
+            }
+        }
+    })(Proto,'trimStart');
+
+})(window);
+*/
+ +

명세서

+ +{{Specifications}} + +

브라우저 호환성

+ +

{{Compat}}

+ +

같이 보기

+ + -- cgit v1.2.3-54-g00ecf