JavaScript/解构:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
第11行: 第11行:
1</pre>}}}}
1</pre>}}}}
{{leftrightflex|<syntaxhighlight lang="javascript">
{{leftrightflex|<syntaxhighlight lang="javascript">
const colors = [];
const [firstColor = 'white'] = [];
const [firstColor = 'white'] = colors;
const [, secondColor = 'black'] = [];</syntaxhighlight>|{{consoleout|<pre>
const [, secondColor = 'black'] = colors;</syntaxhighlight>|{{consoleout|<pre>
white
white
black
black
</pre>}}}}
</pre>}}}}
{{unknown}}
{{unknown}}
{{leftrightflex|<syntaxhighlight lang="javascript">
const [, ...numbers] = [1, 2, 3];</syntaxhighlight>|{{consoleout|<pre>
(2) [2, 3]
</pre>}}}}

2020年6月24日 (三) 16:23的版本

引言

示例

模板:Leftrightflex 模板:Leftrightflex

(来源摘自互联网示例,作者 未知)

模板:Leftrightflex