書名: 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');
推薦閱讀
- Qt 5 and OpenCV 4 Computer Vision Projects
- Getting Started with React
- Developing Mobile Web ArcGIS Applications
- Java FX應用開發教程
- Quarkus實踐指南:構建新一代的Kubernetes原生Java微服務
- Mastering Google App Engine
- 深入RabbitMQ
- C程序設計實踐教程
- OpenCV 4計算機視覺項目實戰(原書第2版)
- HTML5+CSS3 Web前端開發技術(第2版)
- 新一代SDN:VMware NSX 網絡原理與實踐
- Learning Modular Java Programming
- Instant jQuery Boilerplate for Plugins
- HTML5移動前端開發基礎與實戰(微課版)
- 虛擬現實建模與編程(SketchUp+OSG開發技術)