aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorISA <yunjonglyu@gmail.com>2021-07-09 00:18:52 +0900
committerGitHub <noreply@github.com>2021-07-09 00:18:52 +0900
commit1c2dfb2198c3b8ae070b3e093d6c3b4f64a4ff13 (patch)
treefddf6f8f231ceb5fe7cd62862644076cb25b75c6
parent339e0c3197fb32bd4419b7c7e18c499a6c1506c8 (diff)
downloadtranslated-content-1c2dfb2198c3b8ae070b3e093d6c3b4f64a4ff13.tar.gz
translated-content-1c2dfb2198c3b8ae070b3e093d6c3b4f64a4ff13.tar.bz2
translated-content-1c2dfb2198c3b8ae070b3e093d6c3b4f64a4ff13.zip
feat(KO): JS REF - 스트링 TRIM START 문서 추가 (#1431)
* feat(KO): JS REF - 스트링 TRIM START 문서 추가 * Update files/ko/web/javascript/reference/global_objects/string/trimstart/index.html Co-authored-by: JO YUN HO <bedro27@gmail.com> * Update files/ko/web/javascript/reference/global_objects/string/trimstart/index.html Co-authored-by: JO YUN HO <bedro27@gmail.com> Co-authored-by: JO YUN HO <bedro27@gmail.com>
-rw-r--r--files/ko/web/javascript/reference/global_objects/string/trimstart/index.html106
1 files changed, 106 insertions, 0 deletions
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
new file mode 100644
index 0000000000..df264d0078
--- /dev/null
+++ b/files/ko/web/javascript/reference/global_objects/string/trimstart/index.html
@@ -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
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>trimStart()</code></strong>메서드는 문자열 시작부분의 공백을 제거합니다. 또한 <code>trimLeft()</code>라는 별칭으로 호출이 가능합니다.</p>
+
+<div>{{EmbedInteractiveExample("pages/js/string-trimstart.html")}}</div>
+
+
+<h2 id="syntax">구문</h2>
+
+<pre class="brush: js">
+trimStart()
+
+trimLeft()
+</pre>
+
+<h3 id="return_value">반환값</h3>
+
+<p><code><var>str</var></code>시작부분(왼쪽)에서 공백이 제거된 새 문자열을 반환합니다.</p>
+
+<p><code><var>str</var></code>에 공백이 없을시에도 에러가 발생하지 않고 여전히 새 문자열(본질적으로 <code><var>str</var></code>의 복사본)이 반환됩니다.</p>
+
+<h3 id="aliasing">별칭</h3>
+
+<p>{{jsxref("String.prototype.padStart")}}표준 메서드 이름과 같은 함수의 일관성을 위해서<code>trimStart</code>가 되었습니다. 그러나,
+ 웹 호환성을 위해서 <code>trimLeft</code> 이라는 별칭을 가집니다. 일부 엔진에서 이것은 다음 예시를 의미합니다.</p>
+
+<pre class="brush: js">String.prototype.trimLeft.name === "trimStart";</pre>
+
+<h2 id="examples">예제</h2>
+
+<h3 id="using_trimStart">trimStart() 사용</h3>
+
+<p>다음 예제는<code>'foo '</code>문자열을 표시합니다.</p>
+
+<pre class="brush: js highlight: [5]">var str = ' foo ';
+
+console.log(str.length); // 8
+
+str = str.trimStart();
+console.log(str.length); // 5
+console.log(str); // 'foo '
+</pre>
+
+<h2 id="polyfill">폴리필</h2>
+
+<pre class="brush: js highlight: [5]">//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=&gt;{
+ const String=w.String, Proto=String.prototype;
+
+ ((o,p)=&gt;{
+ if(p in o?o[p]?false:true:true){
+ const r=/^\s+/;
+ o[p]=o.trimLeft||function(){
+ return this.replace(r,'')
+ }
+ }
+ })(Proto,'trimStart');
+
+})(window);
+*/</pre>
+
+<h2 id="specifications">명세서</h2>
+
+{{Specifications}}
+
+<h2 id="browser_compatibility">브라우저 호환성</h2>
+
+<p>{{Compat}}</p>
+
+<h2 id="See_also">같이 보기</h2>
+
+<ul>
+ <li><code>String.prototype.trimStart</code>의 폴리필은 <a href="https://github.com/zloirock/core-js#ecmascript-string-and-regexp"><code>core-js</code></a>를 참고하세요.</li>
+ <li>{{jsxref("String.prototype.trim()")}}</li>
+ <li>{{jsxref("String.prototype.trimEnd()")}}</li>
+</ul>