aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/statements/default/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/javascript/reference/statements/default/index.html')
-rw-r--r--files/zh-cn/web/javascript/reference/statements/default/index.html120
1 files changed, 0 insertions, 120 deletions
diff --git a/files/zh-cn/web/javascript/reference/statements/default/index.html b/files/zh-cn/web/javascript/reference/statements/default/index.html
deleted file mode 100644
index 12e076166c..0000000000
--- a/files/zh-cn/web/javascript/reference/statements/default/index.html
+++ /dev/null
@@ -1,120 +0,0 @@
----
-title: default
-slug: Web/JavaScript/Reference/Statements/default
-tags:
- - JavaScript
- - Keyword
-translation_of: Web/JavaScript/Reference/Statements/switch
-translation_of_original: Web/JavaScript/Reference/Statements/default
----
-<div>{{jsSidebar("Statements")}}</div>
-
-<div></div>
-
-<p><strong>default 关键字</strong>可以在 JavaScript 的两种情况下使用:在 {{jsxref("Statements/switch", "switch")}} ,或 {{jsxref("Statements/export", "export")}} 中。</p>
-
-<h2 id="语法">语法</h2>
-
-<p>在{{jsxref("Statements/switch", "switch")}} 语句中使用:</p>
-
-<pre class="syntaxbox">switch (expression) {
- case value1:
- //当表达式的值和value1匹配执行这里的语句
- [break;]
- default:
- //当表达式的值没有匹配,执行这里的语句
- [break;]
-}</pre>
-
-<p>在{{jsxref("Statements/export", "export")}} 中使用:</p>
-
-<pre class="syntaxbox">export default <em>nameN</em> </pre>
-
-<h2 id="描述">描述</h2>
-
-<p>更多细节,参见</p>
-
-<ul>
- <li>{{jsxref("Statements/switch", "switch")}} 语句和</li>
- <li>{{jsxref("Statements/export", "export")}} 语句页面。</li>
-</ul>
-
-<h2 id="示例">示例</h2>
-
-<h3 id="在switch语句中使用default">在<code>switch</code>语句中使用<code>default</code></h3>
-
-<p>在以下示例中,如果<code>expr</code>为“Oranges”或“Apples”,程序将匹配“Oranges”或“Apples”的值并执行相应的声明。在任何其它情况下,<code>default</code>关键字将执行关联的语句。</p>
-
-<pre class="brush: js">switch (expr) {
- case "Oranges":
- console.log("Oranges are $0.59 a pound.");
- break;
- case "Apples":
- console.log("Apples are $0.32 a pound.");
- break;
- default:
- console.log("Sorry, we are out of " + expr + ".");
-}</pre>
-
-<h3 id="在export语句中使用default">在<code>export</code>语句中使用<code>default</code></h3>
-
-<p>如果要导出单个值或需要模块的回调值,则可以使用默认导出: </p>
-
-<pre class="brush: js">// module "my-module.js"
-let cube = function cube(x) {
- return x * x * x;
-}
-export default cube;
-</pre>
-
-<p>然后,在另一个脚本中,默认导出将直接被导入:</p>
-
-<pre class="brush: js">// module "my-module.js"
-import myFunction from 'my-module';
-console.log(myFunction(3)); // 27
-</pre>
-
-<h2 id="规范">规范</h2>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">Specification</th>
- <th scope="col">Status</th>
- <th scope="col">Comment</th>
- </tr>
- <tr>
- <td>{{SpecName('ES6', '#sec-switch-statement', 'switch statement')}}</td>
- <td>{{Spec2('ES6')}}</td>
- <td></td>
- </tr>
- <tr>
- <td>{{SpecName('ES6', '#sec-exports', 'Exports')}}</td>
- <td>{{Spec2('ES6')}}</td>
- <td></td>
- </tr>
- <tr>
- <td>{{SpecName('ESDraft', '#sec-switch-statement', 'switch statement')}}</td>
- <td>{{Spec2('ESDraft')}}</td>
- <td></td>
- </tr>
- <tr>
- <td>{{SpecName('ESDraft', '#sec-exports', 'Exports')}}</td>
- <td>{{Spec2('ESDraft')}}</td>
- <td></td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="浏览器兼容">浏览器兼容</h2>
-
-<div class="hidden">The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</div>
-
-<p>{{Compat("javascript.statements.default")}}</p>
-
-<h2 id="See_also">See also</h2>
-
-<ul>
- <li>{{jsxref("Statements/export", "export")}}</li>
- <li>{{jsxref("Statements/switch", "switch")}}</li>
-</ul>