Results 7 comments of Mr.丁

``` Array.from({length: 12}).map((item, index) => data[index] || null); ```

`var b = 10; (function b() { b = 20; console.log(b); })();` 具名自执行函数的变量为只读属性,不可修改

``` let a = [1, 2, 2, 1], b = [2, 1]; let result = []; if (a.length > b.length) [a, b] = [b, a]; for (let i=0;i -1) {...

``` for (let i = 0;i < ary.length;i++) { for (let j = 0;j < ary.length - i - 1;j++) { if (ary[j] > ary[j + 1]) [ary[j], ary[j +...

``` function format (str) { let ary = str.split(',').map(item => Number(item)); let curIndex = 0, fiAry = []; for (let i = 0; i < ary.length; i++) { if (ary[i]...

undefined,10,20。用var生命的变量存在变量提升,a在作用域里提前声明,但是没有定义,第一个输出undefined,a = 5,定义a的值,局部作用域修改为5,但是window全局对象下的a变量没有改变,输出10,最后var a = 20,给局部作用域赋值,输出20.