書名: JavaScript:Moving to ES2015作者名: Ved Antani Simon Timms Narayan Prusty本章字數: 65字更新時間: 2021-07-09 19:07:35
A matter of style
Like the previous chapters, we will spend some time discussing the style considerations while creating arrays.
- Use the literal syntax for array creation:
// bad const items = new Array(); // good const items = [];
- Use
Array#push
instead of a direct assignment to add items to an array:const stack = []; // bad stack[stack.length] = 'pushme'; // good stack.push('pushme');
推薦閱讀
- Learning NServiceBus(Second Edition)
- Instant Testing with CasperJS
- Hands-On Machine Learning with scikit:learn and Scientific Python Toolkits
- Developing Mobile Web ArcGIS Applications
- Vue.js入門與商城開發實戰
- Programming ArcGIS 10.1 with Python Cookbook
- Django:Web Development with Python
- oreilly精品圖書:軟件開發者路線圖叢書(共8冊)
- C/C++常用算法手冊(第3版)
- 你必須知道的204個Visual C++開發問題
- Raspberry Pi 2 Server Essentials
- Learning Data Mining with R
- Mathematica Data Analysis
- 高級語言程序設計(C語言版):基于計算思維能力培養
- Domain-Driven Design in PHP