语法高亮,滚动条美化,设置页面调整

This commit is contained in:
fofolee
2019-04-19 02:41:09 +08:00
parent 1e8f76c000
commit 359d29ee0b
1590 changed files with 12328 additions and 11441 deletions

View File

@@ -4,16 +4,16 @@
<p><strong>default 关键字</strong>可以在 JavaScript 的两种情况下使用:在 <a href="Reference/Statements/switch" title="switch 语句评估一个表达式将表达式的值与case子句匹配并执行与该情况相关联的语句。"><code>switch</code></a> ,或 <a href="Reference/Statements/export" title="在创建JavaScript模块时export 语句用于从模块中导出函数、对象或原始值以便其他程序可以通过 import 语句使用它们。"><code>export</code></a> 中。</p>
<h2 id="语法">语法</h2>
<p><a href="Reference/Statements/switch" title="switch 语句评估一个表达式将表达式的值与case子句匹配并执行与该情况相关联的语句。"><code>switch</code></a> 语句中使用:</p>
<pre class="syntaxbox">switch (expression) {
<pre><code class="language-javascript">switch (expression) {
case value1:
//当表达式的值和value1匹配执行这里的语句
[break;]
default:
//当表达式的值没有匹配,执行这里的语句
[break;]
}</pre>
}</code></pre>
<p><a href="Reference/Statements/export" title="在创建JavaScript模块时export 语句用于从模块中导出函数、对象或原始值以便其他程序可以通过 import 语句使用它们。"><code>export</code></a> 中使用:</p>
<pre class="syntaxbox">export default <em>nameN</em> </pre>
<pre><code class="language-javascript">export default <em>nameN</em> </code></pre>
<h2 id="描述">描述</h2>
<p>更多细节,参见</p>
<ul>
@@ -23,7 +23,7 @@
<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) {
<pre><code class="language-javascript">switch (expr) {
case "Oranges":
console.log("Oranges are $0.59 a pound.");
break;
@@ -32,20 +32,20 @@
break;
default:
console.log("Sorry, we are out of " + expr + ".");
}</pre>
}</code></pre>
<h3 id="在export语句中使用default"><code>export</code>语句中使用<code>default</code></h3>
<p>如果要导出单个值或需要模块的回掉值,则可以使用默认导出: </p>
<pre class="brush: js">// module "my-module.js"
<pre><code class="language-javascript">// module "my-module.js"
let cube = function cube(x) {
return x * x * x;
}
export default cube;
</pre>
</code></pre>
<p>然后,在另一个脚本中,默认导出将直接被导入:</p>
<pre class="brush: js">// module "my-module.js"
<pre><code class="language-javascript">// module "my-module.js"
import myFunction from 'my-module';
console.log(myFunction(3)); // 27
</pre>
</code></pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>