aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/console/trace
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/console/trace
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/console/trace')
-rw-r--r--files/zh-cn/web/api/console/trace/index.html70
1 files changed, 70 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/console/trace/index.html b/files/zh-cn/web/api/console/trace/index.html
new file mode 100644
index 0000000000..682eba535e
--- /dev/null
+++ b/files/zh-cn/web/api/console/trace/index.html
@@ -0,0 +1,70 @@
+---
+title: console.trace
+slug: Web/API/Console/trace
+translation_of: Web/API/Console/trace
+---
+<p>{{APIRef("Console API")}}</p>
+
+<p>{{domxref("console")}} 的 <strong><code>trace()</code> 方法</strong>向 <a href="/zh-cn/Tools/Web_Console" title="Web Console">Web控制台</a> 输出一个堆栈跟踪。</p>
+
+<p>{{AvailableInWorkers}}</p>
+
+<p>在页面{{ domxref("console") }}文档中查看<a href="/zh-CN/docs/Web/API/console#堆栈跟踪" title="zh-cn/DOM/console#Stack_traces">堆栈跟踪</a>的详细介绍和示例。</p>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<pre class="notranslate">console.trace( [...<var>any</var>, ...<var>data</var> ]);</pre>
+
+<h3 id="参数">参数</h3>
+
+<dl>
+ <dt><code>...<var>any</var>, ...<var>data</var></code> {{optional_inline}}</dt>
+ <dd>Zero or more objects to be output to console along with the trace. These are assembled and formatted the same way they would be if passed to the {{domxref("console.log()")}} method.</dd>
+</dl>
+
+<h2 id="Syntax" name="Syntax">Example</h2>
+
+<pre class="notranslate">function foo() {
+ function bar() {
+ console.trace();
+ }
+ bar();
+}
+
+foo();
+</pre>
+
+<p>In the console, the following trace will be displayed:</p>
+
+<pre class="notranslate">bar
+foo
+&lt;anonymous&gt;</pre>
+
+<h2 id="Specification" name="Specification">规范</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", "#trace", "console.trace()")}}</td>
+ <td>{{Spec2("Console API")}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p>{{Compat("api.Console.trace")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="http://www.opera.com/dragonfly/documentation/console/">Opera Dragonfly documentation: Console</a></li>
+</ul>