- 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');
推薦閱讀
- Getting Started with Gulp(Second Edition)
- Mastering JavaScript Object-Oriented Programming
- OpenCV實(shí)例精解
- Building a RESTful Web Service with Spring
- Windows Presentation Foundation Development Cookbook
- C語(yǔ)言程序設(shè)計(jì)
- Apache Mahout Clustering Designs
- Windows Phone 7.5:Building Location-aware Applications
- Microsoft 365 Certified Fundamentals MS-900 Exam Guide
- Django 5企業(yè)級(jí)Web應(yīng)用開(kāi)發(fā)實(shí)戰(zhàn)(視頻教學(xué)版)
- C++ Application Development with Code:Blocks
- Python Deep Learning
- Android Studio開(kāi)發(fā)實(shí)戰(zhàn):從零基礎(chǔ)到App上線(xiàn) (移動(dòng)開(kāi)發(fā)叢書(shū))
- Visual Basic語(yǔ)言程序設(shè)計(jì)基礎(chǔ)(第3版)
- 快樂(lè)編程:青少年思維訓(xùn)練