diff options
author | MDN <actions@users.noreply.github.com> | 2021-05-29 01:14:43 +0000 |
---|---|---|
committer | MDN <actions@users.noreply.github.com> | 2021-05-29 01:14:43 +0000 |
commit | d94b4f47476bbc901753f68d6dfe317e1c5c732e (patch) | |
tree | 590036437f5c828d71f35d6880228be2b4361b50 /files/ko/orphaned | |
parent | 05a7219ba9605649cb6daa281e26209eaa73adf0 (diff) | |
download | translated-content-d94b4f47476bbc901753f68d6dfe317e1c5c732e.tar.gz translated-content-d94b4f47476bbc901753f68d6dfe317e1c5c732e.tar.bz2 translated-content-d94b4f47476bbc901753f68d6dfe317e1c5c732e.zip |
[CRON] sync translated content
Diffstat (limited to 'files/ko/orphaned')
-rw-r--r-- | files/ko/orphaned/web/javascript/reference/operators/pipeline_operator/index.html | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/files/ko/orphaned/web/javascript/reference/operators/pipeline_operator/index.html b/files/ko/orphaned/web/javascript/reference/operators/pipeline_operator/index.html new file mode 100644 index 0000000000..1202a44bff --- /dev/null +++ b/files/ko/orphaned/web/javascript/reference/operators/pipeline_operator/index.html @@ -0,0 +1,77 @@ +--- +title: 파이프 연산자 +slug: orphaned/Web/JavaScript/Reference/Operators/Pipeline_operator +tags: + - Experimental + - JavaScript + - Operator +translation_of: Web/JavaScript/Reference/Operators/Pipeline_operator +original_slug: Web/JavaScript/Reference/Operators/Pipeline_operator +--- +<div>{{jsSidebar("Operators")}} {{SeeCompatTable}}</div> + +<p><span class="seoSummary"><strong>파이프 연산자</strong>(<code>|></code>)는 실험적 기능(stage 1)으로, 표현식의 값을 함수에 전달합니다. 파이프 연산자를 활용하면 중첩 함수 호출을 좀 더 읽기 좋은 형식으로 작성할 수 있습니다.</span> 결과물은 문법적 설탕<sup>syntactic sugar</sup>으로, 하나의 인수를 제공하는 함수 호출은 다음 코드처럼 쓸 수 있습니다.</p> + +<pre class="brush: js">let url = "%21" |> decodeURI;</pre> + +<p>전통적인 구문에서는 아래처럼 호출합니다.</p> + +<pre class="brush: js">let url = decodeURI("%21"); +</pre> + +<h2 id="구문">구문</h2> + +<pre class="syntaxbox"><em>expression</em> |> <em>function</em> +</pre> + +<p>지정한 <code>expression</code>의 값이 <code>function</code>의 유일한 매개변수로 전달됩니다.</p> + +<h2 id="예제">예제</h2> + +<h3 id="함수_체이닝">함수 체이닝</h3> + +<p>파이프 연산자를 사용해, 여러 번 중첩된 함수 호출을 읽기 편한 형태로 바꿀 수 있습니다.</p> + +<pre class="brush: js">const double = (n) => n * 2; +const increment = (n) => n + 1; + +// 파이프 연산자 없이 +double(increment(double(double(5)))); // 42 + +// 파이프 연산자 사용 +5 |> double |> double |> increment |> double; // 42 +</pre> + +<h2 id="명세">명세</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td><a href="https://tc39.github.io/proposal-pipeline-operator/#sec-intro">Pipeline operator draft</a></td> + <td>Stage 1</td> + <td>Not part of the ECMAScript specification yet.</td> + </tr> + </tbody> +</table> + +<h2 id="브라우저_호환성">브라우저 호환성</h2> + +<div> + + +<p>{{Compat("javascript.operators.pipeline")}}</p> +</div> + +<h2 id="같이_보기">같이 보기</h2> + +<ul> + <li><a href="https://github.com/tc39/proposal-pipeline-operator">Github - Proposal-pipeline-operator</a></li> + <li><a href="https://github.com/tc39/proposals">TC39 제안서</a></li> +</ul> |