Home > Q&A > body text
在看阮一峰老师的es6入门的里面的解构时
1
2
3
4
5
6
7
8
9
10
11
12
13
function f() {
function
f() {
console.log('aaa');
console.log(
'aaa'
);
}
let [x = f()] = [1];
/*等同于下面这段代码*/
let x;
if ([1][0] === undefined) {
if
([1][0] === undefined) {
x = f();
} else {
else
{
x = [1][0];
不太懂这段话该怎么理解,貌似[1][0]是一个number类型的值
三叔2016-11-07 10:42:13
"[1]"数组 仅含1
"1 "取数组第1位