多应用+插件架构,代码干净,支持一键云编译,码云点赞13K star,4.8-4.12 预售价格198元 广告
* [4.1](https://github.com/yuche/javascript#4.1) 使用字面值创建数组。 ~~~ // bad const items = new Array(); // good const items = []; ~~~ * [4.2](https://github.com/yuche/javascript#4.2) 向数组添加元素时使用 Arrary#push 替代直接赋值。 ~~~ const someStack = []; // bad someStack[someStack.length] = 'abracadabra'; // good someStack.push('abracadabra'); ~~~ * [4.3](https://github.com/yuche/javascript#4.3) 使用拓展运算符 `...` 复制数组。 ~~~ // bad const len = items.length; const itemsCopy = []; let i; for (i = 0; i < len; i++) { itemsCopy[i] = items[i]; } // good const itemsCopy = [...items]; ~~~ * [4.4](https://github.com/yuche/javascript#4.4) 使用 Array#from 把一个类数组对象转换成数组。 ~~~ const foo = document.querySelectorAll('.foo'); const nodes = Array.from(foo); ~~~