Giá trị trong danh sách javascript
2. 1 Use const foo = [1, 2]; const bar = foo; bar[0] = 9; console.log(foo[0], bar[0]); // => 9, 959 for all of your references; avoid using const foo = [1, 2]; const bar = foo; bar[0] = 9; console.log(foo[0], bar[0]); // => 9, 960. eslint. const foo = [1, 2]; const bar = foo; bar[0] = 9; console.log(foo[0], bar[0]); // => 9, 961, const foo = [1, 2]; const bar = foo; bar[0] = 9; console.log(foo[0], bar[0]); // => 9, 962 Show
// bad var a = 1; var b = 2; // good const a = 1; const b = 2;
⬆back to top Objects
⬆back to top Arrays
⬆back to top hủy hoại
⬆back to top Dây
⬆back to top Chức năng
⬆back to top Hàm mũi tên
⬆back to top Lớp & Constructor
⬆back to top mô-đun
⬆back to top Trình vòng lặp và Trình tạo
⬆back to top Đặc tính
⬆back to top Biến
⬆back to top cẩu
⬆back to top Toán tử so sánh & Bình đẳng
⬆back to top khối
⬆back to top Tuyên bố kiểm soát
⬆back to top Bình luận
⬆back to top Khoảng trắng
⬆back to top dấu phẩy
⬆back to top dấu chấm phẩy
⬆back to top Loại đúc và ép buộc
⬆back to top quy ước đặt tên
⬆back to top Accessors
⬆back to top Sự kiện
⬆back to top jQuery
⬆back to top ECMAScript 5 Compatibility
⬆back to top ECMAScript 6+ (ES 2015+) Styles
⬆back to top Thư viện tiêu chuẩnThe Standard Library contains utilities that are functionally broken but remain for legacy reasons
⬆back to top thử nghiệm
⬆back to top Performance
⬆back to top ResourcesLearning ES6+
Read This
Tools
Other Style Guides
Other Styles
Further Reading
Books
Blogs
Podcasts
⬆back to top In the WildThis is a list of organizations that are using this style guide. Send us a pull request and we'll add you to the list
⬆back to top TranslationThis style guide is also available in other languages
The JavaScript Style Guide Guide
Chat With Us About JavaScript
Contributors
License(The MIT License) Copyright (c) 2012 Airbnb Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE ⬆back to top AmendmentsWe encourage you to fork this guide and change the rules to fit your team’s style guide. Dưới đây, bạn có thể liệt kê một số sửa đổi đối với hướng dẫn phong cách. Điều này cho phép bạn cập nhật định kỳ hướng dẫn phong cách của mình mà không phải xử lý xung đột hợp nhất |