diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:17 -0500 |
commit | da78a9e329e272dedb2400b79a3bdeebff387d47 (patch) | |
tree | e6ef8aa7c43556f55ddfe031a01cf0a8fa271bfe /files/ko/web/api/console/count/index.html | |
parent | 1109132f09d75da9a28b649c7677bb6ce07c40c0 (diff) | |
download | translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.tar.gz translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.tar.bz2 translated-content-da78a9e329e272dedb2400b79a3bdeebff387d47.zip |
initial commit
Diffstat (limited to 'files/ko/web/api/console/count/index.html')
-rw-r--r-- | files/ko/web/api/console/count/index.html | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/files/ko/web/api/console/count/index.html b/files/ko/web/api/console/count/index.html new file mode 100644 index 0000000000..0040da4c11 --- /dev/null +++ b/files/ko/web/api/console/count/index.html @@ -0,0 +1,102 @@ +--- +title: console.count() +slug: Web/API/Console/count +tags: + - API + - DOM + - Method + - Reference +translation_of: Web/API/Console/count +--- +<div>{{APIRef("Console API")}}</div> + +<p><strong><code>console.count()</code></strong> 메서드는 특정 <code>count()</code> 호출의 횟수를 세어 출력합니다.</p> + +<p>{{AvailableInWorkers}}</p> + +<h2 id="구문">구문</h2> + +<pre class="syntaxbox">console.count(<var>[label]</var>);</pre> + +<h3 id="매개변수">매개변수</h3> + +<dl> + <dt><code>label</code> {{Optional_Inline}}</dt> + <dd>{{jsxref("String")}}. 지정한 경우, 이 레이블을 지정한 count() 호출의 수를 출력합니다. 누락한 경우 <code>"default"</code>를 지정한 것처럼 동작합니다.</dd> +</dl> + +<h2 id="예제">예제</h2> + +<pre class="brush: js; highlight[4, 13]">let user = ""; + +function greet() { + console.count(); + return "hi " + user; +} + +user = "bob"; +greet(); +user = "alice"; +greet(); +greet(); +console.count();</pre> + +<p>위 코드의 출력 결과는 다음과 같은 형태입니다.</p> + +<pre class="brush: none;">"default: 1" +"default: 2" +"default: 3" +"default: 4"</pre> + +<p>레이블을 명시하지 않았기 때문에 <code>default</code>로 나타납니다.</p> + +<p>첫 번째 <code>count()</code>의 매개변수에는 <code>user</code> 변수를 제공하고, 두 번째에는 문자열 <code>"alice"</code>를 제공할 경우...</p> + +<pre class="brush: js; highlight[4, 13]">let user = ""; + +function greet() { + console.count(user); + return "hi " + user; +} + +user = "bob"; +greet(); +user = "alice"; +greet(); +greet(); +console.count("alice");</pre> + +<p>다음과 같이 출력합니다.</p> + +<pre class="brush: none;">"bob: 1" +"alice: 1" +"alice: 2" +"alice: 3"</pre> + +<dl> +</dl> + +<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>{{SpecName("Console API", "#count", "console.count()")}}</td> + <td>{{Spec2("Console API")}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="브라우저_호환성">브라우저 호환성</h2> + + + +<p>{{Compat("api.Console.count")}}</p> |