Hướng dẫn what was the first name of javascript - tên đầu tiên của javascript là gì

".js" chuyển hướng ở đây. Đối với phương ngữ Microsoft được sử dụng trong Internet Explorer, xem JScript.

Show
JavaScript
Hướng dẫn what was the first name of javascript - tên đầu tiên của javascript là gì

Ảnh chụp màn hình mã nguồn JavaScript với HTML

Mô hìnhĐa đa Paradigm: Lập trình theo hướng sự kiện, chức năng, bắt buộc, thủ tục, hướng đối tượng
Designed byBrendan Eich của Netscape ban đầu; Những người khác cũng đã đóng góp cho tiêu chuẩn Ecmascript
First appearedTháng 12 & NBSP; 4, 1995; 26 năm trước [1]; 26 years ago[1]
Phiên bản ổn định

Ecmascript 2021 [2] & nbsp; / Tháng 6 năm 2021; 17 tháng trước

Hướng dẫn what was the first name of javascript - tên đầu tiên của javascript là gì
/ June 2021; 17 months ago

Bản phát hành xem trước

ECMAScript 2022 [3] & NBSP; / 22 tháng 7 năm 2021; 16 tháng trước

Hướng dẫn what was the first name of javascript - tên đầu tiên của javascript là gì
/ 22 July 2021; 16 months ago

Gõ kỷ luậtNăng động, yếu, vịt
Phần mở rộng tên tệp

  • console.log("Hello, World!");
    
    4
  • console.log("Hello, World!");
    
    5
  • console.log("Hello, World!");
    
    6[4]

Trang mạngwww.ecma-international.org/publications-and-standards/standards/ecma-262/
Triển khai chính
V8, JavaScriptCore, Spidermonkey, Chakra
Chịu ảnh hưởng bởi
Java, [5] [6] Sơ đồ, [6] tự, [7] AWK, [8] Hypertalk [9]
Ảnh hưởng
ActionScript, ASSPBLYSCRIPT, CoffeeScript, DART, HAXE, JS ++, Objective-J, Opa, TypeScript
  • Hướng dẫn what was the first name of javascript - tên đầu tiên của javascript là gì
    JavaScript tại Wikibooks

JavaScript (), thường được viết tắt là JS, là ngôn ngữ lập trình là một trong những công nghệ cốt lõi của World Wide Web, cùng với HTML và CSS. Tính đến năm 2022, 98% trang web sử dụng JavaScript ở phía máy khách cho hành vi trang web, thường kết hợp các thư viện của bên thứ ba. Tất cả các trình duyệt web chính có một công cụ JavaScript chuyên dụng để thực thi mã trên thiết bị của người dùng. (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, often incorporating third-party libraries. All major web browsers have a dedicated JavaScript engine to execute the code on users' devices.

JavaScript là một ngôn ngữ được biên dịch cấp cao, thường chỉ trong thời gian phù hợp với tiêu chuẩn Ecmascript. [10] Nó có gõ động, định hướng đối tượng dựa trên nguyên mẫu và các hàm hạng nhất. Đó là các phong cách đa mô hình, hỗ trợ các phong cách lập trình theo sự kiện, chức năng và bắt buộc. Nó có giao diện lập trình ứng dụng (API) để làm việc với văn bản, ngày, biểu thức chính quy, cấu trúc dữ liệu tiêu chuẩn và mô hình đối tượng tài liệu (DOM).

Tiêu chuẩn ECMAScript không bao gồm bất kỳ đầu vào/đầu ra (I/O) nào, chẳng hạn như mạng, lưu trữ hoặc đồ họa. Trong thực tế, trình duyệt web hoặc hệ thống thời gian chạy khác cung cấp API JavaScript cho I/O.

Các động cơ JavaScript ban đầu chỉ được sử dụng trong các trình duyệt web, nhưng hiện là thành phần cốt lõi của một số máy chủ và một loạt các ứng dụng. Hệ thống thời gian chạy phổ biến nhất cho việc sử dụng này là Node.js.

Mặc dù Java và JavaScript tương tự nhau về tên, cú pháp và thư viện tiêu chuẩn tương ứng, hai ngôn ngữ rất khác biệt và khác nhau rất nhiều trong thiết kế.

History[edit][edit]

Sáng tạo tại Netscape [Chỉnh sửa][edit]

Trình duyệt Web đầu tiên với giao diện người dùng đồ họa, khảm, được phát hành vào năm 1993. Có thể truy cập được cho những người phi kỹ thuật, nó đóng một vai trò nổi bật trong sự phát triển nhanh chóng của Web World Wide Wide. [11] Các nhà phát triển chính của khảm sau đó đã thành lập Tập đoàn Netscape, nơi phát hành một trình duyệt được đánh bóng hơn, Netscape Navigator, vào năm 1994. Điều này nhanh chóng trở thành được sử dụng nhiều nhất. [12] [13]

Trong những năm hình thành của web, các trang web chỉ có thể tĩnh, thiếu khả năng cho hành vi động sau khi trang được tải trong trình duyệt. Có một mong muốn trong bối cảnh phát triển web hưng thịnh để loại bỏ giới hạn này, vì vậy vào năm 1995, Netscape đã quyết định thêm một ngôn ngữ kịch bản vào Navigator. Họ đã theo đuổi hai tuyến đường để đạt được điều này: hợp tác với Sun Microsystems để nhúng ngôn ngữ lập trình Java, đồng thời thuê Brendan Eich để nhúng ngôn ngữ sơ đồ. [6]

Quản lý Netscape sớm quyết định rằng lựa chọn tốt nhất là Eich đưa ra một ngôn ngữ mới, với cú pháp tương tự như Java và ít giống như sơ đồ hoặc các ngôn ngữ kịch bản còn tồn tại khác. [5] [6] Mặc dù ngôn ngữ mới và việc thực hiện thông dịch viên của nó được gọi là Livescript khi lần đầu tiên được vận chuyển như một phần của bản beta của Navigator vào tháng 9 năm 1995, tên này đã được đổi thành JavaScript để phát hành chính thức vào tháng 12. [6] [1] [14]

Sự lựa chọn của tên JavaScript đã gây ra sự nhầm lẫn, ngụ ý rằng nó có liên quan trực tiếp đến Java. Vào thời điểm đó, sự bùng nổ dot-com đã bắt đầu và Java là ngôn ngữ mới nóng bỏng, vì vậy Eich coi tên JavaScript là một mưu đồ tiếp thị của Netscape. [15]

Việc áp dụng bởi Microsoft [Chỉnh sửa][edit]

Microsoft đã ra mắt Internet Explorer vào năm 1995, dẫn đến một cuộc chiến trình duyệt với Netscape. Trên mặt trận JavaScript, Microsoft đã thiết kế đảo ngược trình thông dịch điều hướng để tạo riêng, được gọi là JScript. [16]

JScript được phát hành lần đầu tiên vào năm 1996, cùng với sự hỗ trợ ban đầu cho CSS và phần mở rộng cho HTML. Mỗi triển khai này khác nhau đáng kể so với các đối tác của họ trong Navigator. [17] [18] Những khác biệt này khiến các nhà phát triển khó khăn trong việc làm cho trang web của họ hoạt động tốt trong cả hai trình duyệt, dẫn đến việc sử dụng rộng rãi "được xem tốt nhất trong Netscape" và "được xem tốt nhất trong logo Internet Explorer" trong vài năm. [17] [19]

Sự gia tăng của JScript [Chỉnh sửa][edit]

Vào tháng 11 năm 1996, Netscape đã gửi JavaScript lên ECMA International, là điểm khởi đầu cho một đặc điểm kỹ thuật tiêu chuẩn mà tất cả các nhà cung cấp trình duyệt có thể tuân thủ. Điều này dẫn đến việc phát hành chính thức đặc tả ngôn ngữ Ecmascript đầu tiên vào tháng 6 năm 1997.

Quá trình tiêu chuẩn tiếp tục trong một vài năm, với việc phát hành Ecmascript 2 vào tháng 6 năm 1998 và Ecmascript 3 vào tháng 12 năm 1999. Công việc trên Ecmascript 4 bắt đầu vào năm 2000. [16]

Trong khi đó, Microsoft có được một vị trí ngày càng chiếm ưu thế trong thị trường trình duyệt. Đến đầu những năm 2000, thị phần của Internet Explorer đạt 95%. [20] Điều này có nghĩa là JScript trở thành tiêu chuẩn thực tế cho kịch bản phía máy khách trên web.

Microsoft ban đầu tham gia vào quy trình tiêu chuẩn và thực hiện một số đề xuất bằng ngôn ngữ JScript của mình, nhưng cuối cùng nó đã ngừng hợp tác trong công việc ECMA. Do đó, Ecmascript 4 đã bị mothballed.

Tăng trưởng và tiêu chuẩn hóa [Chỉnh sửa][edit]

Trong giai đoạn thống trị của Internet Explorer vào đầu những năm 2000, kịch bản phía khách hàng đã bị đình trệ. Điều này bắt đầu thay đổi vào năm 2004, khi người kế vị của Netscape, Mozilla, phát hành trình duyệt Firefox. Firefox đã được nhiều người đón nhận, chiếm thị phần đáng kể từ Internet Explorer. [21]

Năm 2005, Mozilla gia nhập ECMA International và công việc bắt đầu theo tiêu chuẩn Ecmascript cho XML (E4X). Điều này dẫn đến việc Mozilla hợp tác với Macromedia (sau này được Adobe Systems), người đang thực hiện E4X trong ngôn ngữ ActionScript 3 của họ, dựa trên bản nháp Ecmascript 4. Mục tiêu trở thành tiêu chuẩn hóa ActionScript 3 với tư cách là Ecmascript 4. Cuối cùng, Adobe Systems đã phát hành triển khai Tamarin như một dự án nguồn mở. Tuy nhiên, Tamarin và Actioncript 3 quá khác biệt so với kịch bản phía khách hàng đã thành lập và không có sự hợp tác từ Microsoft, Ecmascript 4 chưa bao giờ đạt được kết quả.

Trong khi đó, những phát triển rất quan trọng đã xảy ra trong các cộng đồng nguồn mở không liên kết với công việc ECMA. Vào năm 2005, Jesse James Garrett đã phát hành một tờ giấy trắng, trong đó anh ta đặt ra thuật ngữ AJAX và mô tả một bộ công nghệ, trong đó JavaScript là xương sống, để tạo các ứng dụng web nơi dữ liệu có thể được tải trong nền, tránh sự cần thiết của trang đầy đủ trang Tải lại. Điều này đã gây ra một thời kỳ Phục hưng của JavaScript, dẫn đầu bởi các thư viện nguồn mở và các cộng đồng hình thành xung quanh họ. Nhiều thư viện mới đã được tạo ra, bao gồm jQuery, nguyên mẫu, bộ công cụ DOJO và mootools.

Google đã ra mắt trình duyệt Chrome vào năm 2008, với động cơ JavaScript V8 nhanh hơn so với đối thủ cạnh tranh. [22] [23] Sự đổi mới quan trọng là biên soạn đúng lúc (JIT), [24] vì vậy các nhà cung cấp trình duyệt khác cần thiết để đại tu động cơ của họ cho JIT. [25]

Vào tháng 7 năm 2008, những bữa tiệc khác nhau này đã cùng nhau tham dự một hội nghị ở Oslo. Điều này dẫn đến thỏa thuận cuối cùng vào đầu năm 2009 để kết hợp tất cả các công việc có liên quan và thúc đẩy ngôn ngữ tiến lên. Kết quả là tiêu chuẩn Ecmascript 5, được phát hành vào tháng 12 năm 2009.

Đạt đến mức trưởng thành [chỉnh sửa][edit]

Công việc đầy tham vọng về ngôn ngữ tiếp tục trong vài năm, đỉnh cao là một bộ sưu tập bổ sung và sàng lọc rộng rãi được chính thức hóa với việc xuất bản Ecmascript 6 vào năm 2015. [26]

Việc tạo ra Node.js năm 2009 của Ryan Dahl đã gây ra sự gia tăng đáng kể trong việc sử dụng JavaScript bên ngoài trình duyệt web. Node kết hợp động cơ V8, vòng lặp sự kiện và API I/O, do đó cung cấp hệ thống thời gian chạy JavaScript độc lập. [27] [28] Kể từ năm 2018, nút đã được hàng triệu nhà phát triển sử dụng, [29] và NPM có nhiều mô -đun nhất của bất kỳ người quản lý gói nào trên thế giới. [30]

Thông số kỹ thuật dự thảo ECMAScript hiện được duy trì công khai trên GitHub và các phiên bản được sản xuất thông qua ảnh chụp nhanh hàng năm. [31] Các sửa đổi tiềm năng đối với ngôn ngữ được xem xét thông qua quy trình đề xuất toàn diện. [32] [33] Bây giờ, thay vì các số phiên bản, các nhà phát triển kiểm tra trạng thái của các tính năng sắp tới riêng lẻ. [31]

Hệ sinh thái JavaScript hiện tại có nhiều thư viện và khung, thực tiễn lập trình được thiết lập và sử dụng đáng kể JavaScript bên ngoài trình duyệt web. Thêm vào đó, với sự gia tăng của các ứng dụng một trang và các trang web nặng JavaScript khác, một số bộ chuyển đổi đã được tạo ra để hỗ trợ quá trình phát triển. [34]

Trademark[edit][edit]

"JavaScript" là nhãn hiệu của Oracle Corporation tại Hoa Kỳ. [35] [36] Thương hiệu ban đầu được phát hành cho Sun Microsystems vào ngày 6 tháng 5 năm 1997 và được chuyển đến Oracle khi họ có được Sun vào năm 2010.

Sử dụng phía khách hàng trang web [Chỉnh sửa][edit]

JavaScript là ngôn ngữ kịch bản phía máy khách thống trị của Web, với 98% tất cả các trang web (giữa năm 2022) sử dụng nó cho mục đích này. [37] Các tập lệnh được nhúng vào hoặc bao gồm từ các tài liệu HTML và tương tác với DOM. Tất cả các trình duyệt web chính có một công cụ JavaScript tích hợp để thực thi mã trên thiết bị của người dùng.(mid–2022) using it for this purpose.[37] Scripts are embedded in or included from HTML documents and interact with the DOM. All major web browsers have a built-in JavaScript engine that executes the code on the user's device.

Ví dụ về hành vi kịch bản [chỉnh sửa][edit]

  • Tải nội dung trang web mới mà không tải lại trang, thông qua AJAX hoặc WebSocket. Ví dụ: người dùng phương tiện truyền thông xã hội có thể gửi và nhận tin nhắn mà không cần rời khỏi trang hiện tại.
  • Hoạt hình trang web, chẳng hạn như các đối tượng mờ dần vào và ra, thay đổi kích thước và di chuyển chúng.
  • Chơi trò chơi trình duyệt.
  • Kiểm soát phát lại phương tiện phát trực tuyến.
  • Tạo quảng cáo bật lên hoặc hộp cảnh báo.
  • Xác thực các giá trị đầu vào của biểu mẫu web trước khi dữ liệu được gửi đến máy chủ web.
  • Đăng nhập dữ liệu về hành vi của người dùng sau đó gửi nó đến máy chủ. Chủ sở hữu trang web có thể sử dụng dữ liệu này để phân tích, theo dõi quảng cáo và cá nhân hóa.
  • Chuyển hướng người dùng sang trang khác.
  • Lưu trữ và truy xuất dữ liệu trên thiết bị của người dùng, thông qua các tiêu chuẩn lưu trữ hoặc lập chỉ mục.

Thư viện và khung [Chỉnh sửa][edit]

Hơn 80% các trang web sử dụng thư viện JavaScript của bên thứ ba hoặc khung web cho kịch bản phía máy khách của họ. [38]

JQuery cho đến nay là thư viện phổ biến nhất, được sử dụng bởi hơn 75% trang web. [38] Facebook đã tạo thư viện React cho trang web của mình và sau đó phát hành nó dưới dạng nguồn mở; Các trang web khác, bao gồm Twitter, hiện sử dụng nó. Tương tự như vậy, khung góc được tạo bởi Google cho các trang web của mình, bao gồm YouTube và Gmail, hiện là một dự án nguồn mở được sử dụng bởi những người khác. [38]

Ngược lại, thuật ngữ "Vanilla JS" đã được đặt ra cho các trang web không sử dụng bất kỳ thư viện hoặc khung nào, thay vào đó hoàn toàn dựa vào chức năng JavaScript tiêu chuẩn. [39]

Cách sử dụng khác [chỉnh sửa][edit]

Việc sử dụng JavaScript đã mở rộng ra ngoài nguồn gốc trình duyệt web của nó. Các động cơ JavaScript hiện được nhúng trong một loạt các hệ thống phần mềm khác, cả cho việc triển khai trang web phía máy chủ và các ứng dụng không phải là trình duyệt.

Những nỗ lực ban đầu trong việc quảng bá sử dụng JavaScript phía máy chủ là NetScape Enterprise Server và các dịch vụ thông tin Internet của Microsoft, [40] [41] nhưng chúng là những ngóc ngách nhỏ. [42] Việc sử dụng phía máy chủ cuối cùng đã bắt đầu phát triển vào cuối những năm 2000, với việc tạo Node.js và các phương pháp khác. [42]

Electron, Cordova, React Native và các khung ứng dụng khác đã được sử dụng để tạo ra nhiều ứng dụng với hành vi được thực hiện trong JavaScript. Các ứng dụng không phải trình duyệt khác bao gồm hỗ trợ Adobe Acrobat cho các tài liệu PDF kịch bản [43] và phần mở rộng vỏ Gnome được viết bằng JavaScript. [44]

JavaScript gần đây đã bắt đầu xuất hiện trong một số hệ thống nhúng, thường là bằng cách tận dụng nút.js. [45] [46] [47]

Features[edit][edit]

Các tính năng sau đây là phổ biến cho tất cả các triển khai Ecmascript phù hợp trừ khi được chỉ định rõ ràng khác.

Bắt buộc và có cấu trúc [chỉnh sửa][edit]

JavaScript hỗ trợ phần lớn cú pháp lập trình có cấu trúc từ C (ví dụ: các câu lệnh

console.log("Hello, World!");
7, các vòng lặp
console.log("Hello, World!");
8, các câu lệnh
console.log("Hello, World!");
9, vòng lặp
// Text nodes can be made using the "write" method.
// This is frowned upon, as it can overwrite the document if the document is fully loaded.
document.write('foo');

// Elements can be made too. First, they have to be created in the DOM.
const myElem = document.createElement('span');

// Attributes like classes and the id can be set as well
myElem.classList.add('foo');
myElem.id = 'bar';

// After setting this, the tag will look like this: ``
myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`

// Finally append it as a child element to the  in the HTML
document.body.appendChild(myElem);

// Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
document.querySelector('.class'); // Selects the first element with the "class" class
document.querySelector('#id'); // Selects the first element with an `id` of "id"
document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class
0, v.v.). Một ngoại lệ một phần là phạm vi: ban đầu JavaScript chỉ có phạm vi chức năng với
// Text nodes can be made using the "write" method.
// This is frowned upon, as it can overwrite the document if the document is fully loaded.
document.write('foo');

// Elements can be made too. First, they have to be created in the DOM.
const myElem = document.createElement('span');

// Attributes like classes and the id can be set as well
myElem.classList.add('foo');
myElem.id = 'bar';

// After setting this, the tag will look like this: ``
myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`

// Finally append it as a child element to the  in the HTML
document.body.appendChild(myElem);

// Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
document.querySelector('.class'); // Selects the first element with the "class" class
document.querySelector('#id'); // Selects the first element with an `id` of "id"
document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class
1; Phạm vi khối đã được thêm vào trong Ecmascript 2015 với các từ khóa
// Text nodes can be made using the "write" method.
// This is frowned upon, as it can overwrite the document if the document is fully loaded.
document.write('foo');

// Elements can be made too. First, they have to be created in the DOM.
const myElem = document.createElement('span');

// Attributes like classes and the id can be set as well
myElem.classList.add('foo');
myElem.id = 'bar';

// After setting this, the tag will look like this: ``
myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`

// Finally append it as a child element to the  in the HTML
document.body.appendChild(myElem);

// Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
document.querySelector('.class'); // Selects the first element with the "class" class
document.querySelector('#id'); // Selects the first element with an `id` of "id"
document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class
2 và
// Text nodes can be made using the "write" method.
// This is frowned upon, as it can overwrite the document if the document is fully loaded.
document.write('foo');

// Elements can be made too. First, they have to be created in the DOM.
const myElem = document.createElement('span');

// Attributes like classes and the id can be set as well
myElem.classList.add('foo');
myElem.id = 'bar';

// After setting this, the tag will look like this: ``
myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`

// Finally append it as a child element to the  in the HTML
document.body.appendChild(myElem);

// Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
document.querySelector('.class'); // Selects the first element with the "class" class
document.querySelector('#id'); // Selects the first element with an `id` of "id"
document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class
3. Giống như C, JavaScript tạo ra sự khác biệt giữa các biểu thức và câu lệnh. Một chênh lệch cú pháp so với C là chèn dấu chấm phẩy tự động, cho phép các dấu chấm phẩy (chấm dứt các câu lệnh) được bỏ qua. [48]

Gõ yếu [chỉnh sửa][edit]

JavaScript được gõ yếu, có nghĩa là một số loại được sử dụng ngầm tùy thuộc vào hoạt động được sử dụng. [49]

  • Toán tử nhị phân
    // Text nodes can be made using the "write" method.
    // This is frowned upon, as it can overwrite the document if the document is fully loaded.
    document.write('foo');
    
    // Elements can be made too. First, they have to be created in the DOM.
    const myElem = document.createElement('span');
    
    // Attributes like classes and the id can be set as well
    myElem.classList.add('foo');
    myElem.id = 'bar';
    
    // After setting this, the tag will look like this: ``
    myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`
    
    // Finally append it as a child element to the  in the HTML
    document.body.appendChild(myElem);
    
    // Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
    document.querySelector('.class'); // Selects the first element with the "class" class
    document.querySelector('#id'); // Selects the first element with an `id` of "id"
    document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
    document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class
    
    4 chuyển cả hai toán hạng vào một chuỗi trừ khi cả hai toán hạng là số. Điều này là do toán tử bổ sung tăng gấp đôi với tư cách là một toán tử nối
  • Toán tử nhị phân
    // Text nodes can be made using the "write" method.
    // This is frowned upon, as it can overwrite the document if the document is fully loaded.
    document.write('foo');
    
    // Elements can be made too. First, they have to be created in the DOM.
    const myElem = document.createElement('span');
    
    // Attributes like classes and the id can be set as well
    myElem.classList.add('foo');
    myElem.id = 'bar';
    
    // After setting this, the tag will look like this: ``
    myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`
    
    // Finally append it as a child element to the  in the HTML
    document.body.appendChild(myElem);
    
    // Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
    document.querySelector('.class'); // Selects the first element with the "class" class
    document.querySelector('#id'); // Selects the first element with an `id` of "id"
    document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
    document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class
    
    5 luôn chuyển cả hai toán hạng vào một số
  • Cả hai toán tử unary (
    // Text nodes can be made using the "write" method.
    // This is frowned upon, as it can overwrite the document if the document is fully loaded.
    document.write('foo');
    
    // Elements can be made too. First, they have to be created in the DOM.
    const myElem = document.createElement('span');
    
    // Attributes like classes and the id can be set as well
    myElem.classList.add('foo');
    myElem.id = 'bar';
    
    // After setting this, the tag will look like this: ``
    myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`
    
    // Finally append it as a child element to the  in the HTML
    document.body.appendChild(myElem);
    
    // Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
    document.querySelector('.class'); // Selects the first element with the "class" class
    document.querySelector('#id'); // Selects the first element with an `id` of "id"
    document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
    document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class
    
    4,
    // Text nodes can be made using the "write" method.
    // This is frowned upon, as it can overwrite the document if the document is fully loaded.
    document.write('foo');
    
    // Elements can be made too. First, they have to be created in the DOM.
    const myElem = document.createElement('span');
    
    // Attributes like classes and the id can be set as well
    myElem.classList.add('foo');
    myElem.id = 'bar';
    
    // After setting this, the tag will look like this: ``
    myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`
    
    // Finally append it as a child element to the  in the HTML
    document.body.appendChild(myElem);
    
    // Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
    document.querySelector('.class'); // Selects the first element with the "class" class
    document.querySelector('#id'); // Selects the first element with an `id` of "id"
    document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
    document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class
    
    5) luôn luôn chuyển toán hạng lên một số

Các giá trị được đúc thành các chuỗi như sau: [49]

  • Chuỗi bị bỏ lại
  • Các số được chuyển đổi thành biểu diễn chuỗi của chúng
  • Mảng có các yếu tố của chúng được đúc thành chuỗi sau đó chúng được tham gia bởi dấu phẩy (
    // Text nodes can be made using the "write" method.
    // This is frowned upon, as it can overwrite the document if the document is fully loaded.
    document.write('foo');
    
    // Elements can be made too. First, they have to be created in the DOM.
    const myElem = document.createElement('span');
    
    // Attributes like classes and the id can be set as well
    myElem.classList.add('foo');
    myElem.id = 'bar';
    
    // After setting this, the tag will look like this: ``
    myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`
    
    // Finally append it as a child element to the  in the HTML
    document.body.appendChild(myElem);
    
    // Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
    document.querySelector('.class'); // Selects the first element with the "class" class
    document.querySelector('#id'); // Selects the first element with an `id` of "id"
    document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
    document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class
    
    8)
  • Các đối tượng khác được chuyển đổi thành chuỗi
    // Text nodes can be made using the "write" method.
    // This is frowned upon, as it can overwrite the document if the document is fully loaded.
    document.write('foo');
    
    // Elements can be made too. First, they have to be created in the DOM.
    const myElem = document.createElement('span');
    
    // Attributes like classes and the id can be set as well
    myElem.classList.add('foo');
    myElem.id = 'bar';
    
    // After setting this, the tag will look like this: ``
    myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`
    
    // Finally append it as a child element to the  in the HTML
    document.body.appendChild(myElem);
    
    // Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
    document.querySelector('.class'); // Selects the first element with the "class" class
    document.querySelector('#id'); // Selects the first element with an `id` of "id"
    document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
    document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class
    
    9 trong đó
    function factorial(n) {
        // Checking the argument for legitimacy. Factorial is defined for positive integers.
        if (isNaN(n)) {
            console.error("Non-numerical argument not allowed.");
            return NaN; // The special value: Not a Number
        }
        if (n === 0)
            return 1; // 0! = 1
        if (n < 0)
            return undefined; // Factorial of negative numbers is not defined.
        if (n % 1) {
            console.warn(`${n} will be rounded to the closest integer. For non-integers consider using gamma function instead.`);
            n = Math.round(n);
        }
        // The above checks need not be repeated in the recursion, hence defining the actual recursive part separately below.
    
        // The following line is a function expression to recursively compute the factorial. It uses the arrow syntax introduced in ES6.
        const recursivelyCompute = a => a > 1 ? a * recursivelyCompute(a - 1) : 1; // Note the use of the ternary operator `?`.
        return recursivelyCompute(n);
    }
    
    factorial(3); // Returns 6
    
    0 là tên của hàm tạo của đối tượng

Các giá trị được đúc theo số bằng cách đúc vào các chuỗi và sau đó đúc các chuỗi thành số. Các quy trình này có thể được sửa đổi bằng cách xác định các hàm

function factorial(n) {
    // Checking the argument for legitimacy. Factorial is defined for positive integers.
    if (isNaN(n)) {
        console.error("Non-numerical argument not allowed.");
        return NaN; // The special value: Not a Number
    }
    if (n === 0)
        return 1; // 0! = 1
    if (n < 0)
        return undefined; // Factorial of negative numbers is not defined.
    if (n % 1) {
        console.warn(`${n} will be rounded to the closest integer. For non-integers consider using gamma function instead.`);
        n = Math.round(n);
    }
    // The above checks need not be repeated in the recursion, hence defining the actual recursive part separately below.

    // The following line is a function expression to recursively compute the factorial. It uses the arrow syntax introduced in ES6.
    const recursivelyCompute = a => a > 1 ? a * recursivelyCompute(a - 1) : 1; // Note the use of the ternary operator `?`.
    return recursivelyCompute(n);
}

factorial(3); // Returns 6
1 và
function factorial(n) {
    // Checking the argument for legitimacy. Factorial is defined for positive integers.
    if (isNaN(n)) {
        console.error("Non-numerical argument not allowed.");
        return NaN; // The special value: Not a Number
    }
    if (n === 0)
        return 1; // 0! = 1
    if (n < 0)
        return undefined; // Factorial of negative numbers is not defined.
    if (n % 1) {
        console.warn(`${n} will be rounded to the closest integer. For non-integers consider using gamma function instead.`);
        n = Math.round(n);
    }
    // The above checks need not be repeated in the recursion, hence defining the actual recursive part separately below.

    // The following line is a function expression to recursively compute the factorial. It uses the arrow syntax introduced in ES6.
    const recursivelyCompute = a => a > 1 ? a * recursivelyCompute(a - 1) : 1; // Note the use of the ternary operator `?`.
    return recursivelyCompute(n);
}

factorial(3); // Returns 6
2 trên nguyên mẫu cho chuỗi và số đúc tương ứng.

JavaScript đã nhận được những lời chỉ trích về cách nó thực hiện các chuyển đổi này vì sự phức tạp của các quy tắc có thể bị nhầm lẫn vì sự không nhất quán. [50] [49] Ví dụ: khi thêm một số vào một chuỗi, số sẽ được chuyển vào một chuỗi trước khi thực hiện kết nối, nhưng khi trừ một số từ một chuỗi, chuỗi được chuyển thành một số trước khi thực hiện trừ.

Chuyển đổi loại JavaScript
Thoại còn lạinhà điều hànhQuyền điều hànhkết quả
function factorial(n) {
    // Checking the argument for legitimacy. Factorial is defined for positive integers.
    if (isNaN(n)) {
        console.error("Non-numerical argument not allowed.");
        return NaN; // The special value: Not a Number
    }
    if (n === 0)
        return 1; // 0! = 1
    if (n < 0)
        return undefined; // Factorial of negative numbers is not defined.
    if (n % 1) {
        console.warn(`${n} will be rounded to the closest integer. For non-integers consider using gamma function instead.`);
        n = Math.round(n);
    }
    // The above checks need not be repeated in the recursion, hence defining the actual recursive part separately below.

    // The following line is a function expression to recursively compute the factorial. It uses the arrow syntax introduced in ES6.
    const recursivelyCompute = a => a > 1 ? a * recursivelyCompute(a - 1) : 1; // Note the use of the ternary operator `?`.
    return recursivelyCompute(n);
}

factorial(3); // Returns 6
3 (mảng trống)
// Text nodes can be made using the "write" method.
// This is frowned upon, as it can overwrite the document if the document is fully loaded.
document.write('foo');

// Elements can be made too. First, they have to be created in the DOM.
const myElem = document.createElement('span');

// Attributes like classes and the id can be set as well
myElem.classList.add('foo');
myElem.id = 'bar';

// After setting this, the tag will look like this: ``
myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`

// Finally append it as a child element to the  in the HTML
document.body.appendChild(myElem);

// Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
document.querySelector('.class'); // Selects the first element with the "class" class
document.querySelector('#id'); // Selects the first element with an `id` of "id"
document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class
4
function factorial(n) {
    // Checking the argument for legitimacy. Factorial is defined for positive integers.
    if (isNaN(n)) {
        console.error("Non-numerical argument not allowed.");
        return NaN; // The special value: Not a Number
    }
    if (n === 0)
        return 1; // 0! = 1
    if (n < 0)
        return undefined; // Factorial of negative numbers is not defined.
    if (n % 1) {
        console.warn(`${n} will be rounded to the closest integer. For non-integers consider using gamma function instead.`);
        n = Math.round(n);
    }
    // The above checks need not be repeated in the recursion, hence defining the actual recursive part separately below.

    // The following line is a function expression to recursively compute the factorial. It uses the arrow syntax introduced in ES6.
    const recursivelyCompute = a => a > 1 ? a * recursivelyCompute(a - 1) : 1; // Note the use of the ternary operator `?`.
    return recursivelyCompute(n);
}

factorial(3); // Returns 6
3 (mảng trống)
// Text nodes can be made using the "write" method.
// This is frowned upon, as it can overwrite the document if the document is fully loaded.
document.write('foo');

// Elements can be made too. First, they have to be created in the DOM.
const myElem = document.createElement('span');

// Attributes like classes and the id can be set as well
myElem.classList.add('foo');
myElem.id = 'bar';

// After setting this, the tag will look like this: ``
myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`

// Finally append it as a child element to the  in the HTML
document.body.appendChild(myElem);

// Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
document.querySelector('.class'); // Selects the first element with the "class" class
document.querySelector('#id'); // Selects the first element with an `id` of "id"
document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class
4
function factorial(n) {
    // Checking the argument for legitimacy. Factorial is defined for positive integers.
    if (isNaN(n)) {
        console.error("Non-numerical argument not allowed.");
        return NaN; // The special value: Not a Number
    }
    if (n === 0)
        return 1; // 0! = 1
    if (n < 0)
        return undefined; // Factorial of negative numbers is not defined.
    if (n % 1) {
        console.warn(`${n} will be rounded to the closest integer. For non-integers consider using gamma function instead.`);
        n = Math.round(n);
    }
    // The above checks need not be repeated in the recursion, hence defining the actual recursive part separately below.

    // The following line is a function expression to recursively compute the factorial. It uses the arrow syntax introduced in ES6.
    const recursivelyCompute = a => a > 1 ? a * recursivelyCompute(a - 1) : 1; // Note the use of the ternary operator `?`.
    return recursivelyCompute(n);
}

factorial(3); // Returns 6
3 (mảng trống)
// Text nodes can be made using the "write" method.
// This is frowned upon, as it can overwrite the document if the document is fully loaded.
document.write('foo');

// Elements can be made too. First, they have to be created in the DOM.
const myElem = document.createElement('span');

// Attributes like classes and the id can be set as well
myElem.classList.add('foo');
myElem.id = 'bar';

// After setting this, the tag will look like this: ``
myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`

// Finally append it as a child element to the  in the HTML
document.body.appendChild(myElem);

// Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
document.querySelector('.class'); // Selects the first element with the "class" class
document.querySelector('#id'); // Selects the first element with an `id` of "id"
document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class
4
function factorial(n) {
    // Checking the argument for legitimacy. Factorial is defined for positive integers.
    if (isNaN(n)) {
        console.error("Non-numerical argument not allowed.");
        return NaN; // The special value: Not a Number
    }
    if (n === 0)
        return 1; // 0! = 1
    if (n < 0)
        return undefined; // Factorial of negative numbers is not defined.
    if (n % 1) {
        console.warn(`${n} will be rounded to the closest integer. For non-integers consider using gamma function instead.`);
        n = Math.round(n);
    }
    // The above checks need not be repeated in the recursion, hence defining the actual recursive part separately below.

    // The following line is a function expression to recursively compute the factorial. It uses the arrow syntax introduced in ES6.
    const recursivelyCompute = a => a > 1 ? a * recursivelyCompute(a - 1) : 1; // Note the use of the ternary operator `?`.
    return recursivelyCompute(n);
}

factorial(3); // Returns 6
6 (Chuỗi trống)
function factorial(n) {
    // Checking the argument for legitimacy. Factorial is defined for positive integers.
    if (isNaN(n)) {
        console.error("Non-numerical argument not allowed.");
        return NaN; // The special value: Not a Number
    }
    if (n === 0)
        return 1; // 0! = 1
    if (n < 0)
        return undefined; // Factorial of negative numbers is not defined.
    if (n % 1) {
        console.warn(`${n} will be rounded to the closest integer. For non-integers consider using gamma function instead.`);
        n = Math.round(n);
    }
    // The above checks need not be repeated in the recursion, hence defining the actual recursive part separately below.

    // The following line is a function expression to recursively compute the factorial. It uses the arrow syntax introduced in ES6.
    const recursivelyCompute = a => a > 1 ? a * recursivelyCompute(a - 1) : 1; // Note the use of the ternary operator `?`.
    return recursivelyCompute(n);
}

factorial(3); // Returns 6
9 (đối tượng trống)
cont counter = function() {
    let count = 0;
    return function() {
        return ++count;
    }
};

const x = counter();
x(); // Returns 1
x(); // Returns 2
x(); // Returns 3
0 (chuỗi)
// Text nodes can be made using the "write" method.
// This is frowned upon, as it can overwrite the document if the document is fully loaded.
document.write('foo');

// Elements can be made too. First, they have to be created in the DOM.
const myElem = document.createElement('span');

// Attributes like classes and the id can be set as well
myElem.classList.add('foo');
myElem.id = 'bar';

// After setting this, the tag will look like this: ``
myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`

// Finally append it as a child element to the  in the HTML
document.body.appendChild(myElem);

// Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
document.querySelector('.class'); // Selects the first element with the "class" class
document.querySelector('#id'); // Selects the first element with an `id` of "id"
document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class
4
function factorial(n) {
    // Checking the argument for legitimacy. Factorial is defined for positive integers.
    if (isNaN(n)) {
        console.error("Non-numerical argument not allowed.");
        return NaN; // The special value: Not a Number
    }
    if (n === 0)
        return 1; // 0! = 1
    if (n < 0)
        return undefined; // Factorial of negative numbers is not defined.
    if (n % 1) {
        console.warn(`${n} will be rounded to the closest integer. For non-integers consider using gamma function instead.`);
        n = Math.round(n);
    }
    // The above checks need not be repeated in the recursion, hence defining the actual recursive part separately below.

    // The following line is a function expression to recursively compute the factorial. It uses the arrow syntax introduced in ES6.
    const recursivelyCompute = a => a > 1 ? a * recursivelyCompute(a - 1) : 1; // Note the use of the ternary operator `?`.
    return recursivelyCompute(n);
}

factorial(3); // Returns 6
3 (mảng trống)
// Text nodes can be made using the "write" method.
// This is frowned upon, as it can overwrite the document if the document is fully loaded.
document.write('foo');

// Elements can be made too. First, they have to be created in the DOM.
const myElem = document.createElement('span');

// Attributes like classes and the id can be set as well
myElem.classList.add('foo');
myElem.id = 'bar';

// After setting this, the tag will look like this: ``
myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`

// Finally append it as a child element to the  in the HTML
document.body.appendChild(myElem);

// Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
document.querySelector('.class'); // Selects the first element with the "class" class
document.querySelector('#id'); // Selects the first element with an `id` of "id"
document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class
4
function factorial(n) {
    // Checking the argument for legitimacy. Factorial is defined for positive integers.
    if (isNaN(n)) {
        console.error("Non-numerical argument not allowed.");
        return NaN; // The special value: Not a Number
    }
    if (n === 0)
        return 1; // 0! = 1
    if (n < 0)
        return undefined; // Factorial of negative numbers is not defined.
    if (n % 1) {
        console.warn(`${n} will be rounded to the closest integer. For non-integers consider using gamma function instead.`);
        n = Math.round(n);
    }
    // The above checks need not be repeated in the recursion, hence defining the actual recursive part separately below.

    // The following line is a function expression to recursively compute the factorial. It uses the arrow syntax introduced in ES6.
    const recursivelyCompute = a => a > 1 ? a * recursivelyCompute(a - 1) : 1; // Note the use of the ternary operator `?`.
    return recursivelyCompute(n);
}

factorial(3); // Returns 6
6 (Chuỗi trống)
// Text nodes can be made using the "write" method.
// This is frowned upon, as it can overwrite the document if the document is fully loaded.
document.write('foo');

// Elements can be made too. First, they have to be created in the DOM.
const myElem = document.createElement('span');

// Attributes like classes and the id can be set as well
myElem.classList.add('foo');
myElem.id = 'bar';

// After setting this, the tag will look like this: ``
myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`

// Finally append it as a child element to the  in the HTML
document.body.appendChild(myElem);

// Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
document.querySelector('.class'); // Selects the first element with the "class" class
document.querySelector('#id'); // Selects the first element with an `id` of "id"
document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class
4
function factorial(n) {
    // Checking the argument for legitimacy. Factorial is defined for positive integers.
    if (isNaN(n)) {
        console.error("Non-numerical argument not allowed.");
        return NaN; // The special value: Not a Number
    }
    if (n === 0)
        return 1; // 0! = 1
    if (n < 0)
        return undefined; // Factorial of negative numbers is not defined.
    if (n % 1) {
        console.warn(`${n} will be rounded to the closest integer. For non-integers consider using gamma function instead.`);
        n = Math.round(n);
    }
    // The above checks need not be repeated in the recursion, hence defining the actual recursive part separately below.

    // The following line is a function expression to recursively compute the factorial. It uses the arrow syntax introduced in ES6.
    const recursivelyCompute = a => a > 1 ? a * recursivelyCompute(a - 1) : 1; // Note the use of the ternary operator `?`.
    return recursivelyCompute(n);
}

factorial(3); // Returns 6
6 (Chuỗi trống)
function factorial(n) {
    // Checking the argument for legitimacy. Factorial is defined for positive integers.
    if (isNaN(n)) {
        console.error("Non-numerical argument not allowed.");
        return NaN; // The special value: Not a Number
    }
    if (n === 0)
        return 1; // 0! = 1
    if (n < 0)
        return undefined; // Factorial of negative numbers is not defined.
    if (n % 1) {
        console.warn(`${n} will be rounded to the closest integer. For non-integers consider using gamma function instead.`);
        n = Math.round(n);
    }
    // The above checks need not be repeated in the recursion, hence defining the actual recursive part separately below.

    // The following line is a function expression to recursively compute the factorial. It uses the arrow syntax introduced in ES6.
    const recursivelyCompute = a => a > 1 ? a * recursivelyCompute(a - 1) : 1; // Note the use of the ternary operator `?`.
    return recursivelyCompute(n);
}

factorial(3); // Returns 6
9 (đối tượng trống)
cont counter = function() {
    let count = 0;
    return function() {
        return ++count;
    }
};

const x = counter();
x(); // Returns 1
x(); // Returns 2
x(); // Returns 3
0 (chuỗi)
cont counter = function() {
    let count = 0;
    return function() {
        return ++count;
    }
};

const x = counter();
x(); // Returns 1
x(); // Returns 2
x(); // Returns 3
1 (Boolean)
function factorial(n) {
    // Checking the argument for legitimacy. Factorial is defined for positive integers.
    if (isNaN(n)) {
        console.error("Non-numerical argument not allowed.");
        return NaN; // The special value: Not a Number
    }
    if (n === 0)
        return 1; // 0! = 1
    if (n < 0)
        return undefined; // Factorial of negative numbers is not defined.
    if (n % 1) {
        console.warn(`${n} will be rounded to the closest integer. For non-integers consider using gamma function instead.`);
        n = Math.round(n);
    }
    // The above checks need not be repeated in the recursion, hence defining the actual recursive part separately below.

    // The following line is a function expression to recursively compute the factorial. It uses the arrow syntax introduced in ES6.
    const recursivelyCompute = a => a > 1 ? a * recursivelyCompute(a - 1) : 1; // Note the use of the ternary operator `?`.
    return recursivelyCompute(n);
}

factorial(3); // Returns 6
6 (Chuỗi trống)
function factorial(n) {
    // Checking the argument for legitimacy. Factorial is defined for positive integers.
    if (isNaN(n)) {
        console.error("Non-numerical argument not allowed.");
        return NaN; // The special value: Not a Number
    }
    if (n === 0)
        return 1; // 0! = 1
    if (n < 0)
        return undefined; // Factorial of negative numbers is not defined.
    if (n % 1) {
        console.warn(`${n} will be rounded to the closest integer. For non-integers consider using gamma function instead.`);
        n = Math.round(n);
    }
    // The above checks need not be repeated in the recursion, hence defining the actual recursive part separately below.

    // The following line is a function expression to recursively compute the factorial. It uses the arrow syntax introduced in ES6.
    const recursivelyCompute = a => a > 1 ? a * recursivelyCompute(a - 1) : 1; // Note the use of the ternary operator `?`.
    return recursivelyCompute(n);
}

factorial(3); // Returns 6
9 (đối tượng trống)
cont counter = function() {
    let count = 0;
    return function() {
        return ++count;
    }
};

const x = counter();
x(); // Returns 1
x(); // Returns 2
x(); // Returns 3
0 (chuỗi)
cont counter = function() {
    let count = 0;
    return function() {
        return ++count;
    }
};

const x = counter();
x(); // Returns 1
x(); // Returns 2
x(); // Returns 3
1 (Boolean)
cont counter = function() {
    let count = 0;
    return function() {
        return ++count;
    }
};

const x = counter();
x(); // Returns 1
x(); // Returns 2
x(); // Returns 3
4 (chuỗi)
________ 45 (chuỗi)

cont counter = function() {
    let count = 0;
    return function() {
        return ++count;
    }
};

const x = counter();
x(); // Returns 1
x(); // Returns 2
x(); // Returns 3
7 (số)

Dynamic[edit][edit]

cont counter = function() {
    let count = 0;
    return function() {
        return ++count;
    }
};

const x = counter();
x(); // Returns 1
x(); // Returns 2
x(); // Returns 3
8 (chuỗi)

cont counter = function() { let count = 0; return function() { return ++count; } }; const x = counter(); x(); // Returns 1 x(); // Returns 2 x(); // Returns 3 5 (chuỗi)[edit]

// Text nodes can be made using the "write" method.
// This is frowned upon, as it can overwrite the document if the document is fully loaded.
document.write('foo');

// Elements can be made too. First, they have to be created in the DOM.
const myElem = document.createElement('span');

// Attributes like classes and the id can be set as well
myElem.classList.add('foo');
myElem.id = 'bar';

// After setting this, the tag will look like this: ``
myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`

// Finally append it as a child element to the  in the HTML
document.body.appendChild(myElem);

// Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
document.querySelector('.class'); // Selects the first element with the "class" class
document.querySelector('#id'); // Selects the first element with an `id` of "id"
document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class
5

// Arrow functions let us omit the `function` keyword.
// Here `long_example` points to an anonymous function value.
const long_example = (input1, input2) => {
    console.log("Hello, World!");
    const output = input1 + input2;

    return output;
};

// If there are no braces, the arrow function simply returns the expression
// So here it's (input1 + input2)
const short_example = (input1, input2) => input1 + input2;

long_example(2, 3); // Prints "Hello, World!" and returns 5
short_example(2, 5);  // Returns 7

// If an arrow function has only one parameter, the parentheses can be removed.
const no_parentheses = input => input + 2;

no_parentheses(3); // Returns 5

// An arrow function, like other function definitions, can be executed in the same statement as they are created.
// This is useful when writing libraries to avoid filling the global scope, and for closures.
let three = ((a, b) => a + b) (1, 2);

const generate_multiplier_function = a => (b => isNaN(b) || !b ? a : a*=b);
const five_multiples = generate_multiplier_function(5); // The supplied argument "seeds" the expression and is retained by a.
five_multiples(1); // Returns 5
five_multiples(3); // Returns 15
five_multiples(4); // Returns 60
2 (số)

// Arrow functions let us omit the `function` keyword.
// Here `long_example` points to an anonymous function value.
const long_example = (input1, input2) => {
    console.log("Hello, World!");
    const output = input1 + input2;

    return output;
};

// If there are no braces, the arrow function simply returns the expression
// So here it's (input1 + input2)
const short_example = (input1, input2) => input1 + input2;

long_example(2, 3); // Prints "Hello, World!" and returns 5
short_example(2, 5);  // Returns 7

// If an arrow function has only one parameter, the parentheses can be removed.
const no_parentheses = input => input + 2;

no_parentheses(3); // Returns 5

// An arrow function, like other function definitions, can be executed in the same statement as they are created.
// This is useful when writing libraries to avoid filling the global scope, and for closures.
let three = ((a, b) => a + b) (1, 2);

const generate_multiplier_function = a => (b => isNaN(b) || !b ? a : a*=b);
const five_multiples = generate_multiplier_function(5); // The supplied argument "seeds" the expression and is retained by a.
five_multiples(1); // Returns 5
five_multiples(3); // Returns 15
five_multiples(4); // Returns 60
5 (Chuỗi)

// Arrow functions let us omit the `function` keyword.
// Here `long_example` points to an anonymous function value.
const long_example = (input1, input2) => {
    console.log("Hello, World!");
    const output = input1 + input2;

    return output;
};

// If there are no braces, the arrow function simply returns the expression
// So here it's (input1 + input2)
const short_example = (input1, input2) => input1 + input2;

long_example(2, 3); // Prints "Hello, World!" and returns 5
short_example(2, 5);  // Returns 7

// If an arrow function has only one parameter, the parentheses can be removed.
const no_parentheses = input => input + 2;

no_parentheses(3); // Returns 5

// An arrow function, like other function definitions, can be executed in the same statement as they are created.
// This is useful when writing libraries to avoid filling the global scope, and for closures.
let three = ((a, b) => a + b) (1, 2);

const generate_multiplier_function = a => (b => isNaN(b) || !b ? a : a*=b);
const five_multiples = generate_multiplier_function(5); // The supplied argument "seeds" the expression and is retained by a.
five_multiples(1); // Returns 5
five_multiples(3); // Returns 15
five_multiples(4); // Returns 60
6 (số)

Functional[edit][edit]

Thường cũng được đề cập là

// Arrow functions let us omit the `function` keyword.
// Here `long_example` points to an anonymous function value.
const long_example = (input1, input2) => {
    console.log("Hello, World!");
    const output = input1 + input2;

    return output;
};

// If there are no braces, the arrow function simply returns the expression
// So here it's (input1 + input2)
const short_example = (input1, input2) => input1 + input2;

long_example(2, 3); // Prints "Hello, World!" and returns 5
short_example(2, 5);  // Returns 7

// If an arrow function has only one parameter, the parentheses can be removed.
const no_parentheses = input => input + 2;

no_parentheses(3); // Returns 5

// An arrow function, like other function definitions, can be executed in the same statement as they are created.
// This is useful when writing libraries to avoid filling the global scope, and for closures.
let three = ((a, b) => a + b) (1, 2);

const generate_multiplier_function = a => (b => isNaN(b) || !b ? a : a*=b);
const five_multiples = generate_multiplier_function(5); // The supplied argument "seeds" the expression and is retained by a.
five_multiples(1); // Returns 5
five_multiples(3); // Returns 15
five_multiples(4); // Returns 60
7 dẫn đến
// Arrow functions let us omit the `function` keyword.
// Here `long_example` points to an anonymous function value.
const long_example = (input1, input2) => {
    console.log("Hello, World!");
    const output = input1 + input2;

    return output;
};

// If there are no braces, the arrow function simply returns the expression
// So here it's (input1 + input2)
const short_example = (input1, input2) => input1 + input2;

long_example(2, 3); // Prints "Hello, World!" and returns 5
short_example(2, 5);  // Returns 7

// If an arrow function has only one parameter, the parentheses can be removed.
const no_parentheses = input => input + 2;

no_parentheses(3); // Returns 5

// An arrow function, like other function definitions, can be executed in the same statement as they are created.
// This is useful when writing libraries to avoid filling the global scope, and for closures.
let three = ((a, b) => a + b) (1, 2);

const generate_multiplier_function = a => (b => isNaN(b) || !b ? a : a*=b);
const five_multiples = generate_multiplier_function(5); // The supplied argument "seeds" the expression and is retained by a.
five_multiples(1); // Returns 5
five_multiples(3); // Returns 15
five_multiples(4); // Returns 60
8 (số). Điều này là sai lệch:
function factorial(n) {
    // Checking the argument for legitimacy. Factorial is defined for positive integers.
    if (isNaN(n)) {
        console.error("Non-numerical argument not allowed.");
        return NaN; // The special value: Not a Number
    }
    if (n === 0)
        return 1; // 0! = 1
    if (n < 0)
        return undefined; // Factorial of negative numbers is not defined.
    if (n % 1) {
        console.warn(`${n} will be rounded to the closest integer. For non-integers consider using gamma function instead.`);
        n = Math.round(n);
    }
    // The above checks need not be repeated in the recursion, hence defining the actual recursive part separately below.

    // The following line is a function expression to recursively compute the factorial. It uses the arrow syntax introduced in ES6.
    const recursivelyCompute = a => a > 1 ? a * recursivelyCompute(a - 1) : 1; // Note the use of the ternary operator `?`.
    return recursivelyCompute(n);
}

factorial(3); // Returns 6
9 được hiểu là một khối mã trống thay vì một đối tượng trống và mảng trống được chuyển đến một số bởi toán tử
// Text nodes can be made using the "write" method.
// This is frowned upon, as it can overwrite the document if the document is fully loaded.
document.write('foo');

// Elements can be made too. First, they have to be created in the DOM.
const myElem = document.createElement('span');

// Attributes like classes and the id can be set as well
myElem.classList.add('foo');
myElem.id = 'bar';

// After setting this, the tag will look like this: ``
myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`

// Finally append it as a child element to the  in the HTML
document.body.appendChild(myElem);

// Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
document.querySelector('.class'); // Selects the first element with the "class" class
document.querySelector('#id'); // Selects the first element with an `id` of "id"
document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class
4 còn lại. Nếu bạn bọc biểu thức trong ngoặc đơn
class Ball {

   constructor(radius) {
      this.radius = radius;
      this.area = Math.PI * ( r ** 2 );
   }

   // Classes (and thus objects) can contain functions known as methods
   show() {
      drawCircle(this.radius); // References another function (that draws a circle)
   }

};

const myBall = new Ball(5); // Creates a new instance of the ball object with radius 5
myBall.radius++; // Object properties can usually be modified from the outside
myBall.show(); // Using the inherited "show" function
1, các dấu ngoặc xoăn được hiểu là một đối tượng trống và kết quả của biểu thức là
cont counter = function() {
    let count = 0;
    return function() {
        return ++count;
    }
};

const x = counter();
x(); // Returns 1
x(); // Returns 2
x(); // Returns 3
0 như mong đợi. [49]

Delegative[edit][edit]

JavaScript hỗ trợ ủy quyền ngầm và rõ ràng.

Các chức năng như vai trò (đặc điểm và mixin) JavaScript tự nhiên hỗ trợ các mẫu thực hiện dựa trên chức năng khác nhau [62] như các đặc điểm [63] [64] và mixin. [65] Một hàm như vậy xác định hành vi bổ sung bằng ít nhất một phương thức liên kết với từ khóa
function sum() {
    let x = 0;

    for (let i = 0; i < arguments.length; ++i)
        x += arguments[i];

    return x;
}

sum(1, 2); // Returns 3
sum(1, 2, 3); // Returns 6

// As of ES6, using the rest operator.
function sum(...args) {
    return args.reduce((a,b) => a+b);
}

sum(1, 2); // Returns 3
sum(1, 2, 3); // Returns 6
8 trong thân máy ____ của nó. Một vai trò sau đó phải được ủy quyền rõ ràng thông qua
let counter = (function() {
    let i = 0; // Private property

    return {   // Public methods
        get: function() {
            alert(i);
        },
        set: function(value) {
            i = value;
        },
        increment: function() {
            alert(++i);
        }
    };
})(); // Module

counter.get(); // Returns 0
counter.set(6);
counter.increment(); // Returns 7
counter.increment(); // Returns 8
0 hoặc
let counter = (function() {
    let i = 0; // Private property

    return {   // Public methods
        get: function() {
            alert(i);
        },
        set: function(value) {
            i = value;
        },
        increment: function() {
            alert(++i);
        }
    };
})(); // Module

counter.get(); // Returns 0
counter.set(6);
counter.increment(); // Returns 7
counter.increment(); // Returns 8
1 cho các đối tượng cần có hành vi bổ sung không được chia sẻ thông qua chuỗi nguyên mẫu. Chuỗi nguyên mẫu được đi bộ để, ví dụ, tìm một phương pháp có thể liên quan đến nhưng không thuộc sở hữu trực tiếp của một đối tượng. Khi phương thức được tìm thấy, nó được gọi trong bối cảnh của đối tượng này. Do đó, sự kế thừa trong JavaScript được bao phủ bởi một chủ nghĩa tự động của phái đoàn được liên kết với thuộc tính nguyên mẫu của các hàm tạo hàm.

Miscellaneous[edit][edit]

JavaScript là ngôn ngữ không chỉ số.

Môi trường thời gian chạy thường dựa vào môi trường thời gian chạy (ví dụ: trình duyệt web) để cung cấp các đối tượng và phương thức mà các tập lệnh có thể tương tác với môi trường (ví dụ: DOM trang web). Những môi trường này là một luồng đơn. JavaScript cũng dựa vào môi trường thời gian chạy để cung cấp khả năng bao gồm/nhập tập lệnh (ví dụ: các yếu tố HTML
let counter = (function() {
    let i = 0; // Private property

    return {   // Public methods
        get: function() {
            alert(i);
        },
        set: function(value) {
            i = value;
        },
        increment: function() {
            alert(++i);
        }
    };
})(); // Module

counter.get(); // Returns 0
counter.set(6);
counter.increment(); // Returns 7
counter.increment(); // Returns 8
2). Đây không phải là một tính năng ngôn ngữ mỗi se, nhưng nó phổ biến trong hầu hết các triển khai JavaScript. JavaScript xử lý các tin nhắn từ một hàng đợi một lần. JavaScript gọi một hàm được liên kết với mỗi thông báo mới, tạo khung ngăn xếp cuộc gọi với các đối số của hàm và các biến cục bộ. Ngăn xếp cuộc gọi co lại và phát triển dựa trên nhu cầu của chức năng. Khi ngăn xếp cuộc gọi trống khi hoàn thành chức năng, JavaScript sẽ tiến hành tin nhắn tiếp theo trong hàng đợi. Đây được gọi là vòng lặp sự kiện, được mô tả là "chạy để hoàn thành" vì mỗi tin nhắn được xử lý đầy đủ trước khi tin nhắn tiếp theo được xem xét. Tuy nhiên, mô hình đồng thời của ngôn ngữ mô tả vòng lặp sự kiện là không chặn: đầu vào/đầu ra của chương trình được thực hiện bằng các sự kiện và các chức năng gọi lại. Điều này có nghĩa là, ví dụ, JavaScript có thể xử lý một cú nhấp chuột trong khi chờ truy vấn cơ sở dữ liệu để trả về thông tin. [66] Chức năng Variadic có thể được chuyển đến một hàm. Hàm có thể truy cập chúng thông qua các tham số chính thức và cũng thông qua đối tượng
let counter = (function() {
    let i = 0; // Private property

    return {   // Public methods
        get: function() {
            alert(i);
        },
        set: function(value) {
            i = value;
        },
        increment: function() {
            alert(++i);
        }
    };
})(); // Module

counter.get(); // Returns 0
counter.set(6);
counter.increment(); // Returns 7
counter.increment(); // Returns 8
3 cục bộ. Các hàm variadic cũng có thể được tạo bằng cách sử dụng phương thức
let counter = (function() {
    let i = 0; // Private property

    return {   // Public methods
        get: function() {
            alert(i);
        },
        set: function(value) {
            i = value;
        },
        increment: function() {
            alert(++i);
        }
    };
})(); // Module

counter.get(); // Returns 0
counter.set(6);
counter.increment(); // Returns 7
counter.increment(); // Returns 8
4. Biểu diễn và đối tượng giống như nhiều ngôn ngữ, mảng và đối tượng kịch bản (mảng liên kết trong các ngôn ngữ khác) có thể được tạo bằng cú pháp phím tắt ngắn gọn. Trên thực tế, các chữ này tạo thành cơ sở của định dạng dữ liệu JSON. Biểu thức regularsjavascript cũng hỗ trợ các biểu thức chính quy theo cách tương tự như Perl, cung cấp một cú pháp ngắn gọn và mạnh mẽ cho thao tác văn bản tinh vi hơn các hàm chuỗi tích hợp. [[[[ 67] Lời hứa và Async/AwaitjavaScript hỗ trợ hứa hẹn và async/đang chờ xử lý các hoạt động không đồng bộ. Một đối tượng hứa hẹn tích hợp cung cấp chức năng để xử lý lời hứa và liên kết các trình xử lý với kết quả cuối cùng của hành động không đồng bộ. Gần đây, các phương thức tổ hợp đã được giới thiệu trong đặc tả JavaScript, cho phép các nhà phát triển kết hợp nhiều lời hứa JavaScript và thực hiện các hoạt động dựa trên các kịch bản khác nhau. Các phương pháp được giới thiệu là: Promise.race, Promise.all, Promise.allsettled và Promise.any. ASYNC/AIDIT cho phép một hàm không đồng bộ, không chặn được cấu trúc theo cách tương tự như hàm đồng bộ thông thường. Mã không đồng bộ, không chặn có thể được viết, với chi phí tối thiểu, có cấu trúc tương tự như mã chặn đồng bộ truyền thống.

Tiện ích mở rộng dành riêng cho nhà cung cấp [Chỉnh sửa][edit]

Trong lịch sử, một số công cụ JavaScript đã hỗ trợ các tính năng không chuẩn này:

  • Điều kiện
    let counter = (function() {
        let i = 0; // Private property
    
        return {   // Public methods
            get: function() {
                alert(i);
            },
            set: function(value) {
                i = value;
            },
            increment: function() {
                alert(++i);
            }
        };
    })(); // Module
    
    counter.get(); // Returns 0
    counter.set(6);
    counter.increment(); // Returns 7
    counter.increment(); // Returns 8
    
    5 mệnh đề (như Java)
  • Các biểu thức toàn diện và biểu thức máy phát (như Python)
  • Biểu thức chức năng ngắn gọn (
    let counter = (function() {
        let i = 0; // Private property
    
        return {   // Public methods
            get: function() {
                alert(i);
            },
            set: function(value) {
                i = value;
            },
            increment: function() {
                alert(++i);
            }
        };
    })(); // Module
    
    counter.get(); // Returns 0
    counter.set(6);
    counter.increment(); // Returns 7
    counter.increment(); // Returns 8
    
    6; Syntax thử nghiệm này có chức năng mũi tên)
  • ECMAScript cho XML (E4X), một tiện ích mở rộng thêm hỗ trợ XML gốc vào ECMAScript (không được hỗ trợ trong Firefox kể từ phiên bản 21 [68])

Syntax[edit][edit]

Ví dụ đơn giản [chỉnh sửa][edit]

Các biến trong JavaScript có thể được xác định bằng cách sử dụng các từ khóa ____ 21, [69] ____ 22 [70] hoặc ____ 23 [71]. Các biến được xác định mà không có từ khóa sẽ được xác định ở phạm vi toàn cầu.

// Declares a function-scoped variable named `x`, and implicitly assigns the
// special value `undefined` to it. Variables without value are automatically
// set to undefined.
// var is generally considered bad practice and let and const are usually preferred.
var x;

// Variables can be manually set to `undefined` like so
let x2 = undefined;

// Declares a block-scoped variable named `y`, and implicitly sets it to
// `undefined`. The `let` keyword was introduced in ECMAScript 2015.
let y;

// Declares a block-scoped, un-reassignable variable named `z`, and sets it to
// a string literal. The `const` keyword was also introduced in ECMAScript 2015,
// and must be explicitly assigned to.

// The keyword `const` means constant, hence the variable cannot be reassigned
// as the value is `constant`.
const z = "this value cannot be reassigned!";

// Declares a global-scoped variable and assigns 3.  This is generally considered
// bad practice, and will not work if strict mode is on.
t = 3;

// Declares a variable named `myNumber`, and assigns a number literal (the value
// `2`) to it.
let myNumber = 2;

// Reassigns `myNumber`, setting it to a string literal (the value `"foo"`).
// JavaScript is a dynamically-typed language, so this is legal.
myNumber = "foo";

Lưu ý các ý kiến ​​trong ví dụ trên, tất cả đều được đi trước với hai dấu gạch chéo về phía trước.

Không có chức năng đầu vào/đầu ra tích hợp trong JavaScript, thay vào đó nó được cung cấp bởi môi trường thời gian chạy. Thông số kỹ thuật ECMAScript trong Phiên bản 5.1 đề cập rằng "không có quy định nào trong thông số kỹ thuật này cho đầu vào dữ liệu bên ngoài hoặc đầu ra của kết quả tính toán". [72] Tuy nhiên, hầu hết các môi trường thời gian chạy đều có đối tượng

function* rawCounter() {
    yield 1;
    yield 2;
}

function* dynamicCounter() {
    let count = 0;
    while(true) {
        // It is not recommended to utilize while true loops in most cases.
        yield ++count;
    }
}

// Instances
const counter1 = rawCounter();
const counter2 = dynamicCounter();

// Implementation
counter1.next(); // {value: 1, done: false}
counter1.next(); // {value: 2, done: false}
counter1.next(); // {value: undefined, done: true}

counter2.next(); // {value: 1, done: false}
counter2.next(); // {value: 2, done: false}
counter2.next(); // {value: 3, done: false}
// ...infinitely
0 có thể được sử dụng để in đầu ra. [73] Dưới đây là chương trình Hello World tối giản trong JavaScript trong môi trường thời gian chạy với đối tượng console:

console.log("Hello, World!");

Trong các tài liệu HTML, một chương trình như thế này là bắt buộc đối với đầu ra:

// Text nodes can be made using the "write" method.
// This is frowned upon, as it can overwrite the document if the document is fully loaded.
document.write('foo');

// Elements can be made too. First, they have to be created in the DOM.
const myElem = document.createElement('span');

// Attributes like classes and the id can be set as well
myElem.classList.add('foo');
myElem.id = 'bar';

// After setting this, the tag will look like this: ``
myElem.setAttribute('data-attr', 'baz'); // Which could also be written as `myElem.dataset.attr = 'baz'`

// Finally append it as a child element to the  in the HTML
document.body.appendChild(myElem);

// Elements can be imperatively grabbed with querySelector for one element, or querySelectorAll for multiple elements that can be looped with forEach
document.querySelector('.class'); // Selects the first element with the "class" class
document.querySelector('#id'); // Selects the first element with an `id` of "id"
document.querySelector('[data-other]'); // Selects the first element with the "data-other" attribute
document.querySelectorAll('.multiple'); // Returns an Array of all elements with the "multiple" class

Một hàm đệ quy đơn giản để tính toán giai thừa của một số tự nhiên:

function factorial(n) {
    // Checking the argument for legitimacy. Factorial is defined for positive integers.
    if (isNaN(n)) {
        console.error("Non-numerical argument not allowed.");
        return NaN; // The special value: Not a Number
    }
    if (n === 0)
        return 1; // 0! = 1
    if (n < 0)
        return undefined; // Factorial of negative numbers is not defined.
    if (n % 1) {
        console.warn(`${n} will be rounded to the closest integer. For non-integers consider using gamma function instead.`);
        n = Math.round(n);
    }
    // The above checks need not be repeated in the recursion, hence defining the actual recursive part separately below.

    // The following line is a function expression to recursively compute the factorial. It uses the arrow syntax introduced in ES6.
    const recursivelyCompute = a => a > 1 ? a * recursivelyCompute(a - 1) : 1; // Note the use of the ternary operator `?`.
    return recursivelyCompute(n);
}

factorial(3); // Returns 6

Một hàm ẩn danh (hoặc lambda):

cont counter = function() {
    let count = 0;
    return function() {
        return ++count;
    }
};

const x = counter();
x(); // Returns 1
x(); // Returns 2
x(); // Returns 3

Ví dụ này cho thấy, trong JavaScript, đóng chức năng đóng các biến không cục bộ của chúng bằng tham chiếu.

Các chức năng mũi tên lần đầu tiên được giới thiệu trong Phiên bản thứ 6 - ECMAScript 2015. Họ rút ngắn cú pháp để viết các chức năng trong JavaScript. Các chức năng mũi tên là ẩn danh, vì vậy một biến cần thiết để tham khảo chúng để gọi chúng sau khi chúng tạo ra, trừ khi được bao quanh bởi dấu ngoặc đơn và được thực hiện ngay lập tức.

Ví dụ về hàm mũi tên:

// Arrow functions let us omit the `function` keyword.
// Here `long_example` points to an anonymous function value.
const long_example = (input1, input2) => {
    console.log("Hello, World!");
    const output = input1 + input2;

    return output;
};

// If there are no braces, the arrow function simply returns the expression
// So here it's (input1 + input2)
const short_example = (input1, input2) => input1 + input2;

long_example(2, 3); // Prints "Hello, World!" and returns 5
short_example(2, 5);  // Returns 7

// If an arrow function has only one parameter, the parentheses can be removed.
const no_parentheses = input => input + 2;

no_parentheses(3); // Returns 5

// An arrow function, like other function definitions, can be executed in the same statement as they are created.
// This is useful when writing libraries to avoid filling the global scope, and for closures.
let three = ((a, b) => a + b) (1, 2);

const generate_multiplier_function = a => (b => isNaN(b) || !b ? a : a*=b);
const five_multiples = generate_multiplier_function(5); // The supplied argument "seeds" the expression and is retained by a.
five_multiples(1); // Returns 5
five_multiples(3); // Returns 15
five_multiples(4); // Returns 60

Trong JavaScript, các đối tượng thường được tạo bằng cách tạo một thể hiện của một lớp. Các phiên bản cũ hơn của JavaScript thay vào đó sử dụng một đối tượng chức năng.

Ví dụ đối tượng:

class Ball {

   constructor(radius) {
      this.radius = radius;
      this.area = Math.PI * ( r ** 2 );
   }

   // Classes (and thus objects) can contain functions known as methods
   show() {
      drawCircle(this.radius); // References another function (that draws a circle)
   }

};

const myBall = new Ball(5); // Creates a new instance of the ball object with radius 5
myBall.radius++; // Object properties can usually be modified from the outside
myBall.show(); // Using the inherited "show" function

Trình diễn chức năng Variadic (

let counter = (function() {
    let i = 0; // Private property

    return {   // Public methods
        get: function() {
            alert(i);
        },
        set: function(value) {
            i = value;
        },
        increment: function() {
            alert(++i);
        }
    };
})(); // Module

counter.get(); // Returns 0
counter.set(6);
counter.increment(); // Returns 7
counter.increment(); // Returns 8
3 là một biến đặc biệt): [74]

function sum() {
    let x = 0;

    for (let i = 0; i < arguments.length; ++i)
        x += arguments[i];

    return x;
}

sum(1, 2); // Returns 3
sum(1, 2, 3); // Returns 6

// As of ES6, using the rest operator.
function sum(...args) {
    return args.reduce((a,b) => a+b);
}

sum(1, 2); // Returns 3
sum(1, 2, 3); // Returns 6

Các biểu thức chức năng được phát sóng ngay lập tức thường được sử dụng để tạo đóng cửa. Đóng cửa cho phép thu thập các thuộc tính và phương pháp trong không gian tên và làm cho một số trong số chúng riêng tư:

let counter = (function() {
    let i = 0; // Private property

    return {   // Public methods
        get: function() {
            alert(i);
        },
        set: function(value) {
            i = value;
        },
        increment: function() {
            alert(++i);
        }
    };
})(); // Module

counter.get(); // Returns 0
counter.set(6);
counter.increment(); // Returns 7
counter.increment(); // Returns 8

Các đối tượng của máy phát (dưới dạng các hàm tạo) cung cấp một hàm có thể gọi, thoát và nhập lại trong khi duy trì bối cảnh nội bộ (trạng thái). [75]

function* rawCounter() {
    yield 1;
    yield 2;
}

function* dynamicCounter() {
    let count = 0;
    while(true) {
        // It is not recommended to utilize while true loops in most cases.
        yield ++count;
    }
}

// Instances
const counter1 = rawCounter();
const counter2 = dynamicCounter();

// Implementation
counter1.next(); // {value: 1, done: false}
counter1.next(); // {value: 2, done: false}
counter1.next(); // {value: undefined, done: true}

counter2.next(); // {value: 1, done: false}
counter2.next(); // {value: 2, done: false}
counter2.next(); // {value: 3, done: false}
// ...infinitely


JavaScript có thể xuất và nhập từ các mô -đun: [76]

Ví dụ xuất khẩu:

console.log("Hello, World!");
0

Ví dụ nhập khẩu:

console.log("Hello, World!");
1

Ví dụ nâng cao hơn [Chỉnh sửa][edit]

Mã mẫu này hiển thị các tính năng JavaScript khác nhau.

console.log("Hello, World!");
2

Đầu ra sau phải được hiển thị trong cửa sổ trình duyệt.

console.log("Hello, World!");
3

Security[edit][edit]

JavaScript và DOM cung cấp tiềm năng cho các tác giả độc hại để cung cấp các tập lệnh để chạy trên máy khách qua web. Các tác giả trình duyệt giảm thiểu rủi ro này bằng hai hạn chế. Đầu tiên, các tập lệnh chạy trong hộp cát trong đó chúng chỉ có thể thực hiện các hành động liên quan đến web, chứ không phải các tác vụ lập trình có mục đích chung như tạo tệp. Thứ hai, các tập lệnh bị hạn chế bởi chính sách đồng nghĩa: Các tập lệnh từ một trang web không có quyền truy cập vào thông tin như tên người dùng, mật khẩu hoặc cookie được gửi đến một trang web khác. Hầu hết các lỗi bảo mật liên quan đến JavaScript là vi phạm chính sách gốc giống nhau hoặc hộp cát.

Có các tập hợp con của JavaScript chung ADSAFE, ECMAscript (SES) an toàn cung cấp mức độ bảo mật lớn hơn, đặc biệt là trên mã được tạo bởi các bên thứ ba (như quảng cáo). [77] [78] Công cụ đóng cửa là một dự án khác để nhúng an toàn và cách ly JavaScript của bên thứ ba và HTML. [79]

Chính sách bảo mật nội dung là phương pháp dự định chính để đảm bảo rằng chỉ có mã đáng tin cậy được thực thi trên một trang web.

Các lỗ hổng chéo trang [Chỉnh sửa][edit]

Một vấn đề bảo mật liên quan đến JavaScript phổ biến là kịch bản chéo trang (XSS), vi phạm chính sách đồng nghĩa. Các lỗ hổng XSS xảy ra khi kẻ tấn công có thể gây ra trang web đích, chẳng hạn như trang web ngân hàng trực tuyến, bao gồm một kịch bản độc hại trong trang web được trình bày cho nạn nhân. Kịch bản trong ví dụ này sau đó có thể truy cập vào ứng dụng ngân hàng với các đặc quyền của nạn nhân, có khả năng tiết lộ thông tin bí mật hoặc chuyển tiền mà không cần sự cho phép của nạn nhân. Một giải pháp cho các lỗ hổng XSS là sử dụng HTML Escaping bất cứ khi nào hiển thị dữ liệu không tin cậy.

Một số trình duyệt bao gồm bảo vệ một phần chống lại các cuộc tấn công XSS được phản ánh, trong đó kẻ tấn công cung cấp một URL bao gồm cả kịch bản độc hại. Tuy nhiên, ngay cả người dùng của các trình duyệt đó cũng dễ bị các cuộc tấn công XSS khác, chẳng hạn như những người được lưu trữ trong cơ sở dữ liệu. Chỉ thiết kế chính xác các ứng dụng web ở phía máy chủ có thể ngăn chặn hoàn toàn XSS.

Các lỗ hổng XSS cũng có thể xảy ra do các lỗi thực hiện của các tác giả trình duyệt. [80]

Một lỗ hổng chéo khác là giả mạo yêu cầu chéo (CSRF). Trong CSRF, mã trên trang web của kẻ tấn công sẽ lừa trình duyệt của nạn nhân thực hiện các hành động mà người dùng không có ý định tại một trang web mục tiêu (như chuyển tiền tại ngân hàng). Khi các trang web mục tiêu chỉ dựa vào cookie để xác thực yêu cầu, các yêu cầu có nguồn gốc từ mã trên trang web của kẻ tấn công có thể mang thông tin đăng nhập hợp lệ tương tự của người dùng khởi xướng. Nói chung, giải pháp cho CSRF là yêu cầu giá trị xác thực trong trường biểu mẫu ẩn và không chỉ trong cookie, để xác thực bất kỳ yêu cầu nào có thể có hiệu ứng lâu dài. Kiểm tra tiêu đề giới thiệu HTTP cũng có thể giúp đỡ.

"Hijacking JavaScript" là một loại tấn công CSRF trong đó thẻ

let counter = (function() {
    let i = 0; // Private property

    return {   // Public methods
        get: function() {
            alert(i);
        },
        set: function(value) {
            i = value;
        },
        increment: function() {
            alert(++i);
        }
    };
})(); // Module

counter.get(); // Returns 0
counter.set(6);
counter.increment(); // Returns 7
counter.increment(); // Returns 8
2 trên trang web của kẻ tấn công khai thác một trang trên trang web của nạn nhân trả về thông tin cá nhân như JSON hoặc JavaScript. Các giải pháp có thể bao gồm:

  • Yêu cầu một mã thông báo xác thực trong bài đăng và nhận các tham số cho bất kỳ phản hồi nào trả về thông tin cá nhân.

Nỗi tin sai vào khách hàng [Chỉnh sửa][edit]

Các nhà phát triển của các ứng dụng máy khách-máy chủ phải nhận ra rằng các máy khách không đáng tin cậy có thể nằm dưới sự kiểm soát của những kẻ tấn công. Tác giả ứng dụng không thể cho rằng mã JavaScript của họ sẽ chạy như dự định (hoặc hoàn toàn) vì bất kỳ bí mật nào được nhúng trong mã có thể được trích xuất bởi một đối thủ xác định. Một số hàm ý là:

  • Các tác giả trang web không thể che giấu hoàn hảo cách thức hoạt động của JavaScript vì mã nguồn thô phải được gửi đến máy khách. Mã này có thể bị che giấu, nhưng obfuscation có thể được thiết kế ngược.
  • Xác thực biểu mẫu JavaScript chỉ cung cấp sự tiện lợi cho người dùng, không bảo mật. Nếu một trang web xác minh rằng người dùng đã đồng ý với các điều khoản dịch vụ của mình hoặc lọc các ký tự không hợp lệ ra khỏi các trường chỉ nên chứa các số, thì nó phải làm như vậy trên máy chủ, không chỉ máy khách.
  • Các tập lệnh có thể bị vô hiệu hóa có chọn lọc, vì vậy JavaScript không thể dựa vào để ngăn chặn các hoạt động như nhấp chuột phải vào hình ảnh để lưu nó. [81]
  • Nó được coi là rất tệ để nhúng thông tin nhạy cảm như mật khẩu trong JavaScript vì nó có thể được trích xuất bởi kẻ tấn công. [82]

Niềm tin không đúng chỗ cho các nhà phát triển [chỉnh sửa][edit]

Các hệ thống quản lý gói như NPM và Bower là phổ biến với các nhà phát triển JavaScript. Các hệ thống như vậy cho phép nhà phát triển dễ dàng quản lý các phụ thuộc của chương trình vào các thư viện chương trình của các nhà phát triển khác. Các nhà phát triển tin tưởng rằng những người bảo trì các thư viện sẽ giữ cho họ an toàn và cập nhật, nhưng điều đó không phải lúc nào cũng đúng. Một lỗ hổng đã xuất hiện vì sự tin tưởng mù quáng này. Các thư viện tin cậy có thể có các bản phát hành mới khiến các lỗi hoặc lỗ hổng xuất hiện trong tất cả các chương trình dựa trên các thư viện. Ngược lại, một thư viện có thể không phù hợp với các lỗ hổng đã biết trong tự nhiên. Trong một nghiên cứu được thực hiện xem xét một mẫu gồm 133.000 trang web, các nhà nghiên cứu đã tìm thấy 37% các trang web bao gồm một thư viện có ít nhất một lỗ hổng đã biết. [83] "Độ trễ trung bình giữa phiên bản thư viện lâu đời nhất được sử dụng trên mỗi trang web và phiên bản mới nhất có sẵn của thư viện đó là 1.177 ngày ở Alexa và sự phát triển của một số thư viện vẫn đang được sử dụng tích cực từ nhiều năm trước." [83] Một khả năng khác là người bảo trì của một thư viện có thể loại bỏ hoàn toàn thư viện. Điều này xảy ra vào tháng 3 năm 2016 khi Azer Koçulu gỡ kho lưu trữ của mình khỏi NPM. Điều này khiến hàng chục ngàn chương trình và trang web tùy thuộc vào thư viện của anh ta bị phá vỡ. [84] [85]

Trình duyệt và lỗi mã hóa plugin [Chỉnh sửa][edit]

JavaScript cung cấp một giao diện cho một loạt các khả năng trình duyệt, một số trong đó có thể có các lỗ hổng như tràn bộ đệm. Những sai sót này có thể cho phép kẻ tấn công viết các tập lệnh sẽ chạy bất kỳ mã nào họ muốn trên hệ thống của người dùng. Mã này không phải bằng bất kỳ phương tiện nào giới hạn trong một ứng dụng JavaScript khác. Ví dụ, khai thác ghi đè bộ đệm có thể cho phép kẻ tấn công có quyền truy cập vào API của hệ điều hành với các đặc quyền của siêu người dùng.

Những sai sót này đã ảnh hưởng đến các trình duyệt chính bao gồm Firefox, [86] Internet Explorer, [87] và Safari. [88]

Các plugin, chẳng hạn như Trình phát video, Adobe Flash và phạm vi điều khiển hoạt động rộng được bật theo mặc định trong Microsoft Internet Explorer, cũng có thể bị khai thác thông qua JavaScript (các lỗ hổng như vậy đã được khai thác trong quá khứ). [89] [90]

Trong Windows Vista, Microsoft đã cố gắng ngăn chặn các rủi ro của các lỗi như tràn bộ đệm bằng cách chạy quy trình Internet Explorer với các đặc quyền hạn chế. [91] Google Chrome tương tự giới hạn các trình kết xuất trang của mình với "hộp cát" của riêng họ.

Lỗi triển khai hộp cát [Chỉnh sửa][edit]

Trình duyệt web có khả năng chạy JavaScript bên ngoài hộp cát, với các đặc quyền cần thiết, ví dụ, tạo hoặc xóa các tệp. Các đặc quyền như vậy không được dự định sẽ được cấp cho mã từ web.

Việc cấp không chính xác các đặc quyền cho JavaScript từ Web đã đóng một vai trò trong các lỗ hổng trong cả Internet Explorer [92] và Firefox. [93] Trong Windows XP Service Pack 2, Microsoft đã giải phóng các đặc quyền của JScript trong Internet Explorer. [94]

Microsoft Windows cho phép các tệp nguồn JavaScript trên ổ cứng của máy tính được khởi chạy dưới dạng các chương trình không có mục đích chung, không được sử dụng (xem: Máy chủ Windows Script). Điều này làm cho JavaScript (như VBScript) trở thành một vectơ khả thi về mặt lý thuyết cho một con ngựa thành Troia, mặc dù ngựa trojan JavaScript là không phổ biến trong thực tế. [95] [Xác minh thất bại]failed verification]

Lỗ hổng phần cứng [Chỉnh sửa][edit]

Vào năm 2015, một triển khai bằng chứng về khái niệm dựa trên JavaScript của một cuộc tấn công Rowhammer đã được mô tả trong một bài báo bởi các nhà nghiên cứu bảo mật. [96] [97] [98] [99]

Vào năm 2017, một cuộc tấn công dựa trên JavaScript thông qua trình duyệt đã được chứng minh rằng có thể bỏ qua ASLR. Nó được gọi là "Aslr⊕cache" hoặc anc. [100] [101]

Vào năm 2018, bài báo đã công bố các cuộc tấn công của Spectre chống lại việc thực hiện đầu cơ trong Intel và các bộ xử lý khác bao gồm việc triển khai JavaScript. [102]

Công cụ phát triển [Chỉnh sửa][edit]

Các công cụ quan trọng đã phát triển với ngôn ngữ.

  • Mỗi trình duyệt web lớn đều có các công cụ phát triển web tích hợp, bao gồm trình gỡ lỗi JavaScript.
  • Các công cụ phân tích chương trình tĩnh, chẳng hạn như ESLINT và JSLINT, quét mã JavaScript để phù hợp với một tập hợp các tiêu chuẩn và hướng dẫn.
  • Một số trình duyệt có cấu hình tích hợp. Các thư viện định hình độc lập cũng đã được tạo, chẳng hạn như Benchmark.js và JSbench. [103] [104]
  • Nhiều trình chỉnh sửa văn bản có cú pháp Hỗ trợ Hỗ trợ cho mã JavaScript.

[edit]edit]

Java[edit][edit]

Một quan niệm sai lầm phổ biến là JavaScript giống như Java. Cả hai thực sự có một cú pháp giống C (ngôn ngữ C là ngôn ngữ tổ tiên chung ngay lập tức nhất của họ). Chúng cũng thường được hộp cát (khi được sử dụng bên trong trình duyệt) và JavaScript được thiết kế với cú pháp và thư viện tiêu chuẩn của Java. Cụ thể, tất cả các từ khóa Java được dành riêng trong JavaScript gốc, Thư viện tiêu chuẩn của JavaScript tuân theo các quy ước đặt tên của Java và các đối tượng

function* rawCounter() {
    yield 1;
    yield 2;
}

function* dynamicCounter() {
    let count = 0;
    while(true) {
        // It is not recommended to utilize while true loops in most cases.
        yield ++count;
    }
}

// Instances
const counter1 = rawCounter();
const counter2 = dynamicCounter();

// Implementation
counter1.next(); // {value: 1, done: false}
counter1.next(); // {value: 2, done: false}
counter1.next(); // {value: undefined, done: true}

counter2.next(); // {value: 1, done: false}
counter2.next(); // {value: 2, done: false}
counter2.next(); // {value: 3, done: false}
// ...infinitely
3 và
function* rawCounter() {
    yield 1;
    yield 2;
}

function* dynamicCounter() {
    let count = 0;
    while(true) {
        // It is not recommended to utilize while true loops in most cases.
        yield ++count;
    }
}

// Instances
const counter1 = rawCounter();
const counter2 = dynamicCounter();

// Implementation
counter1.next(); // {value: 1, done: false}
counter1.next(); // {value: 2, done: false}
counter1.next(); // {value: undefined, done: true}

counter2.next(); // {value: 1, done: false}
counter2.next(); // {value: 2, done: false}
counter2.next(); // {value: 3, done: false}
// ...infinitely
4 của JavaScript dựa trên các lớp từ Java 1.0. [105]

Cả Java và JavaScript đều xuất hiện lần đầu tiên vào năm 1995, nhưng Java được phát triển bởi James Gosling của Sun Microsystems và JavaScript của Brendan Eich của Netscape Communications.

Sự khác biệt giữa hai ngôn ngữ nổi bật hơn sự tương đồng của chúng. Java có gõ tĩnh, trong khi gõ của JavaScript là động. Java được tải từ mã byte được biên dịch, trong khi JavaScript được tải dưới dạng mã nguồn có thể đọc được của con người. Các đối tượng của Java là dựa trên lớp, trong khi JavaScript dựa trên nguyên mẫu. Cuối cùng, Java đã không hỗ trợ lập trình chức năng cho đến khi Java 8, trong khi JavaScript đã làm như vậy ngay từ đầu, bị ảnh hưởng bởi sơ đồ.

JSON[edit][edit]

JSON, hoặc ký hiệu đối tượng JavaScript, là một định dạng trao đổi dữ liệu có mục đích chung được định nghĩa là một tập hợp con của cú pháp theo nghĩa đen của đối tượng JavaScript.

TypeScript[edit][edit]

TypeScript (TS) là một biến thể được gõ chặt chẽ của JavaScript. TS khác nhau bằng cách giới thiệu các chú thích loại cho các biến và hàm và giới thiệu một ngôn ngữ loại để mô tả các loại trong JS. Mặt khác, TS chia sẻ nhiều tính năng tương tự như JS, để cho phép nó dễ dàng được chuyển sang JS để chạy phía máy khách và tương tác với mã JS khác. [106]

WebAssembly[edit][edit]

Kể từ năm 2017, các trình duyệt web đã hỗ trợ WebAssugging, định dạng nhị phân cho phép công cụ JavaScript thực hiện các phần quan trọng hiệu suất của các tập lệnh trang web gần với tốc độ gốc. [107] Mã WebAssugging chạy trong cùng một hộp cát với mã JavaScript thông thường.

ASM.JS là một tập hợp con của JavaScript đóng vai trò là tiền thân của WebAssugging. [108]

Transpilers[edit][edit]

JavaScript là ngôn ngữ phía máy khách thống trị của Web và nhiều trang web nặng kịch bản. Do đó, các bộ chuyển đổi đã được tạo để chuyển đổi mã được viết bằng các ngôn ngữ khác, có thể hỗ trợ quá trình phát triển. [34]

References[edit][edit]

  1. ^ Bản phát hành Abpress thông báo JavaScript, "Netscape và Sun thông báo JavaScript", PR Newswire, ngày 4 tháng 12 năm 1995a b Press release announcing JavaScript, "Netscape and Sun announce JavaScript", PR Newswire, December 4, 1995
  2. ^"Đặc điểm kỹ thuật ngôn ngữ ECMAScript® 2021". Tháng 6 năm 2021. Truy cập ngày 27 tháng 7 năm 2021. "ECMAScript® 2021 language specification". June 2021. Retrieved 27 July 2021.
  3. ^https: //tc39.es/ecma262/; Truy cập: 27 tháng 7 năm 2021; Ngày xuất bản: 22 tháng 7 năm 2021. https://tc39.es/ecma262/; retrieved: 27 July 2021; publication date: 22 July 2021.
  4. ^"nodejs/nút-eps". GitHub. Được lưu trữ từ bản gốc vào ngày 2020-08-29. Truy cập 2018-07-05. "nodejs/node-eps". GitHub. Archived from the original on 2020-08-29. Retrieved 2018-07-05.
  5. ^ Abseibel, Peter (ngày 16 tháng 9 năm 2009). Các lập trình viên tại nơi làm việc: Những phản ánh về nghề lập trình. ISBN & NBSP; 9781430219484. Được lưu trữ từ bản gốc vào ngày 24 tháng 12 năm 2020. Truy cập ngày 25 tháng 12 năm 2018. Eich: Mối quan tâm ngay lập tức tại Netscape là nó phải trông giống như Java.a b Seibel, Peter (September 16, 2009). Coders at Work: Reflections on the Craft of Programming. ISBN 9781430219484. Archived from the original on December 24, 2020. Retrieved December 25, 2018. Eich: The immediate concern at Netscape was it must look like Java.
  6. ^ ABCDE "Chương 4. Cách JavaScript được tạo ra". nóis.com. Được lưu trữ từ bản gốc vào ngày 2020-02-27. Truy cập 2017-11-21.a b c d e "Chapter 4. How JavaScript Was Created". speakingjs.com. Archived from the original on 2020-02-27. Retrieved 2017-11-21.
  7. ^"Sự nổi tiếng - Brendan Eich". "Popularity – Brendan Eich".
  8. ^"Brendan Eich: Giới thiệu về JavaScript, JSConf 2010". YouTube. p. & nbsp; 22m. Được lưu trữ từ bản gốc vào ngày 29 tháng 8 năm 2020. Truy cập ngày 25 tháng 11 năm 2019. Eich: "Chức năng", tám chữ cái, tôi bị ảnh hưởng bởi AWK. "Brendan Eich: An Introduction to JavaScript, JSConf 2010". YouTube. p. 22m. Archived from the original on August 29, 2020. Retrieved November 25, 2019. Eich: "function", eight letters, I was influenced by AWK.
  9. ^Eich, Brendan (1998). "Lời tựa". Trong Goodman, Danny (chủ biên). Kinh thánh JavaScript (thứ 3 & nbsp; ed.). John Wiley & Sons. ISBN & NBSP; 0-7645-3188-3. LCCN & NBSP; 97078208. OCLC & NBSP; 38888873. Ol & nbsp; 712205m. Eich, Brendan (1998). "Foreword". In Goodman, Danny (ed.). JavaScript Bible (3rd ed.). John Wiley & Sons. ISBN 0-7645-3188-3. LCCN 97078208. OCLC 38888873. OL 712205M.
  10. ^"Đặc điểm kỹ thuật ngôn ngữ ECMAScript® 2020". Được lưu trữ từ bản gốc vào ngày 2020-05-08. Truy cập 2020-05-08. "ECMAScript® 2020 Language Specification". Archived from the original on 2020-05-08. Retrieved 2020-05-08.
  11. ^"Người thay đổi trò chơi Bloomberg: Marc Andreessen". Bloomberg. Bloomberg. Ngày 17 tháng 3 năm 2011. Lưu trữ từ bản gốc vào ngày 16 tháng 5 năm 2012. Truy cập ngày 7 tháng 12 năm 2011. "Bloomberg Game Changers: Marc Andreessen". Bloomberg. Bloomberg. March 17, 2011. Archived from the original on May 16, 2012. Retrieved December 7, 2011.
  12. ^Enzer, Larry (ngày 31 tháng 8 năm 2018). "Sự phát triển của các trình duyệt web". Các nhà phát triển web Monmouth. Được lưu trữ từ bản gốc vào ngày 31 tháng 8 năm 2018. Truy cập ngày 31 tháng 8 năm 2018. Enzer, Larry (August 31, 2018). "The Evolution of the Web Browsers". Monmouth Web Developers. Archived from the original on August 31, 2018. Retrieved August 31, 2018.
  13. ^Dickerson, Gordon (ngày 31 tháng 8 năm 2018). "Tìm hiểu lịch sử của các trình duyệt web". Washingtonindepinent.com. Truy cập ngày 31 tháng 8 năm 2018. Dickerson, Gordon (August 31, 2018). "Learn the History of Web Browsers". washingtonindependent.com. Retrieved August 31, 2018.
  14. ^"TechVision: Những người đổi mới của mạng: Brendan Eich và JavaScript". Được lưu trữ từ bản gốc vào ngày 8 tháng 2 năm 2008. "TechVision: Innovators of the Net: Brendan Eich and JavaScript". Archived from the original on February 8, 2008.
  15. ^Fin JS (17 tháng 6 năm 2016), Brendan Eich & nbsp; - Giám đốc điều hành của Brave, được lưu trữ từ bản gốc vào ngày 10 tháng 2 năm 2019, lấy ra ngày 7 tháng 2 năm 2018 Fin JS (June 17, 2016), Brendan Eich – CEO of Brave, archived from the original on February 10, 2019, retrieved February 7, 2018
  16. ^ AB "Chương 5. Tiêu chuẩn hóa: Ecmascript". nóis.com. Được lưu trữ từ bản gốc vào ngày 1 tháng 11 năm 2021. Truy cập ngày 1 tháng 11 năm 2021.a b "Chapter 5. Standardization: ECMAScript". speakingjs.com. Archived from the original on 1 November 2021. Retrieved 1 November 2021.
  17. ^ Abchampeon, Steve (ngày 6 tháng 4 năm 2001). "JavaScript, làm thế nào chúng ta đến đây?". oreilly.com. Được lưu trữ từ bản gốc vào ngày 19 tháng 7 năm 2016. Truy cập ngày 16 tháng 7 năm 2016.a b Champeon, Steve (April 6, 2001). "JavaScript, How Did We Get Here?". oreilly.com. Archived from the original on July 19, 2016. Retrieved July 16, 2016.
  18. ^"Microsoft Internet Explorer 3.0 Beta hiện có sẵn". Microsoft.com. Microsoft. Ngày 29 tháng 5 năm 1996. Lưu trữ từ bản gốc vào ngày 24 tháng 11 năm 2020. Truy cập ngày 16 tháng 7 năm 2016. "Microsoft Internet Explorer 3.0 Beta Now Available". microsoft.com. Microsoft. May 29, 1996. Archived from the original on November 24, 2020. Retrieved July 16, 2016.
  19. ^McCracken, Harry (ngày 16 tháng 9 năm 2010). "Sự trở lại không mong muốn của" Được xem tốt nhất với Internet Explorer "". Công nghệ.com. Được lưu trữ từ bản gốc vào ngày 23 tháng 6 năm 2018. Truy cập ngày 16 tháng 7 năm 2016. McCracken, Harry (September 16, 2010). "The Unwelcome Return of "Best Viewed with Internet Explorer"". technologizer.com. Archived from the original on June 23, 2018. Retrieved July 16, 2016.
  20. ^Baker, Loren (ngày 24 tháng 11 năm 2004). "Thị phần Trình duyệt Internet Mozilla Firefox tăng lên 7,4%". Tạp chí công cụ tìm kiếm. Được lưu trữ từ bản gốc vào ngày 7 tháng 5 năm 2021. Truy cập ngày 8 tháng 5 năm 2021. Baker, Loren (November 24, 2004). "Mozilla Firefox Internet Browser Market Share Gains to 7.4%". Search Engine Journal. Archived from the original on May 7, 2021. Retrieved May 8, 2021.
  21. ^Weber, Tim (ngày 9 tháng 5 năm 2005). "Cuộc tấn công vào phần mềm khổng lồ Microsoft". Tin tức BBC. Được lưu trữ từ bản gốc vào ngày 25 tháng 9 năm 2017. Weber, Tim (May 9, 2005). "The assault on software giant Microsoft". BBC News. Archived from the original on September 25, 2017.
  22. ^"Kiểm tra so sánh trình duyệt lớn: Internet Explorer so với Firefox, Opera, Safari và Chrome". Phần cứng trò chơi PC. Computec Media Ag. Ngày 3 tháng 7 năm 2009. Được lưu trữ từ bản gốc vào ngày 2 tháng 5 năm 2012. Truy cập ngày 28 tháng 6 năm 2010. "Big browser comparison test: Internet Explorer vs. Firefox, Opera, Safari and Chrome". PC Games Hardware. Computec Media AG. 3 July 2009. Archived from the original on May 2, 2012. Retrieved June 28, 2010.
  23. ^Purdy, Kevin (ngày 11 tháng 6 năm 2009). "Bài kiểm tra tốc độ Lifehacker: Safari 4, Chrome 2". Lifehacker. Được lưu trữ từ bản gốc vào ngày 14 tháng 4 năm 2021. Truy cập ngày 8 tháng 5 năm 2021. Purdy, Kevin (June 11, 2009). "Lifehacker Speed Tests: Safari 4, Chrome 2". Lifehacker. Archived from the original on April 14, 2021. Retrieved May 8, 2021.
  24. ^"Tracemonkey: JavaScript Lightspeed, blog của Brendan Eich". Được lưu trữ từ bản gốc vào ngày 4 tháng 12 năm 2015. Truy cập ngày 22 tháng 7 năm 2020. "TraceMonkey: JavaScript Lightspeed, Brendan Eich's Blog". Archived from the original on December 4, 2015. Retrieved July 22, 2020.
  25. ^"Mozilla hỏi, 'Chúng ta đã nhanh chưa?'". Có dây. Được lưu trữ từ bản gốc vào ngày 22 tháng 6 năm 2018. Truy cập ngày 18 tháng 1 năm 2019. "Mozilla asks, 'Are we fast yet?'". Wired. Archived from the original on June 22, 2018. Retrieved January 18, 2019.
  26. ^"Ecmascript 6: Các tính năng mới: Tổng quan và so sánh". ES6-Features.org. Được lưu trữ từ bản gốc vào ngày 18 tháng 3 năm 2018. Truy cập ngày 19 tháng 3 năm 2018. "ECMAScript 6: New Features: Overview and Comparison". es6-features.org. Archived from the original on March 18, 2018. Retrieved March 19, 2018.
  27. ^Professional Node.js: Xây dựng phần mềm có thể mở rộng dựa trên JavaScript 2017-03-24 tại Wayback Machine, John Wiley & Sons, 01-OCT-2012 Professional Node.js: Building JavaScript Based Scalable Software Archived 2017-03-24 at the Wayback Machine, John Wiley & Sons, 01-Oct-2012
  28. ^Sams dạy bản thân Node.js trong 24 giờ được lưu trữ 2017-03-23 ​​tại Wayback Machine, Sams Publishing, 05-Sep-2012 Sams Teach Yourself Node.js in 24 Hours Archived 2017-03-23 at the Wayback Machine, Sams Publishing, 05-Sep-2012
  29. ^Lawton, George (19 tháng 7 năm 2018). "Lịch sử bí mật đằng sau sự thành công của NPM và Node". Theserverside. Được lưu trữ từ bản gốc vào ngày 2 tháng 8 năm 2021. Truy cập ngày 2 tháng 8 năm 2021. Lawton, George (19 July 2018). "The secret history behind the success of npm and Node". TheServerSide. Archived from the original on 2 August 2021. Retrieved 2 August 2021.
  30. ^Brown, Paul (13 tháng 1 năm 2017). "Nhà nước của Liên minh: NPM". Linux.com. Được lưu trữ từ bản gốc vào ngày 2 tháng 8 năm 2021. Truy cập ngày 2 tháng 8 năm 2021. Brown, Paul (13 January 2017). "State of the Union: npm". Linux.com. Archived from the original on 2 August 2021. Retrieved 2 August 2021.
  31. ^ Abbranscombe, Mary (2016-05-04). "Tiêu chuẩn JavaScript chuyển sang lịch phát hành hàng năm; đây là những gì mới cho ES16". Ngăn xếp mới. Được lưu trữ từ bản gốc vào ngày 2021-01-16. Truy cập 2021-01-15.a b Branscombe, Mary (2016-05-04). "JavaScript Standard Moves to Yearly Release Schedule; Here is What's New for ES16". The New Stack. Archived from the original on 2021-01-16. Retrieved 2021-01-15.
  32. ^"Quá trình TC39". TC39.es. Ecma International. Được lưu trữ từ bản gốc vào ngày 2021-02-07. Truy cập 2021-01-15. "The TC39 Process". tc39.es. Ecma International. Archived from the original on 2021-02-07. Retrieved 2021-01-15.
  33. ^"Đề xuất Ecmascript". TC39. Được lưu trữ từ bản gốc vào ngày 2020-12-04. Truy cập 2021-01-15. "ECMAScript proposals". TC39. Archived from the original on 2020-12-04. Retrieved 2021-01-15.
  34. ^ Abashkenas, Jeremy. "Danh sách các ngôn ngữ biên soạn cho JS". GitHub. Được lưu trữ từ bản gốc vào ngày 31 tháng 1 năm 2020. Truy cập ngày 6 tháng 2 năm 2020.a b Ashkenas, Jeremy. "List of languages that compile to JS". GitHub. Archived from the original on January 31, 2020. Retrieved February 6, 2020.
  35. ^"Hoa Kỳ SERIAL SERIAL Số 75026640". uspto.gov. Văn phòng bằng sáng chế và nhãn hiệu Hoa Kỳ. 1997-05-06. Được lưu trữ từ bản gốc vào ngày 2021-07-13. Truy cập 2021-05-08. "U.S. Trademark Serial No. 75026640". uspto.gov. United States Patent and Trademark Office. 1997-05-06. Archived from the original on 2021-07-13. Retrieved 2021-05-08.
  36. ^"Thông báo pháp lý". Oracle.com. Tập đoàn Oracle. Được lưu trữ từ bản gốc vào ngày 2021-06-05. Truy cập 2021-05-08. "Legal Notices". oracle.com. Oracle Corporation. Archived from the original on 2021-06-05. Retrieved 2021-05-08.
  37. ^"Thống kê sử dụng của JavaScript làm ngôn ngữ lập trình phía máy khách trên các trang web". W3Techs.com. 2021-04-09. Được lưu trữ từ bản gốc vào ngày 2022-02-13. Truy cập 2021-04-09. "Usage statistics of JavaScript as client-side programming language on websites". w3techs.com. 2021-04-09. Archived from the original on 2022-02-13. Retrieved 2021-04-09.
  38. ^ ABC "Thống kê sử dụng của các thư viện JavaScript cho các trang web". W3Techs.com. Được lưu trữ từ bản gốc vào năm 2012-05-26. Truy cập 2021-04-09.a b c "Usage statistics of JavaScript libraries for websites". w3techs.com. Archived from the original on 2012-05-26. Retrieved 2021-04-09.
  39. ^"Vanilla JS". Vanilla-js.com. 2020-06-16. Được lưu trữ từ bản gốc vào ngày 16 tháng 6 năm 2020. Truy cập ngày 17 tháng 6 năm 2020. "Vanilla JS". vanilla-js.com. 2020-06-16. Archived from the original on June 16, 2020. Retrieved June 17, 2020.
  40. ^"Hướng dẫn JavaScript phía máy chủ". Oracle.com. Tập đoàn Oracle. Ngày 11 tháng 12 năm 1998. Lưu trữ từ bản gốc vào ngày 11 tháng 3 năm 2021. Truy cập ngày 8 tháng 5 năm 2021. "Server-Side JavaScript Guide". oracle.com. Oracle Corporation. December 11, 1998. Archived from the original on March 11, 2021. Retrieved May 8, 2021.
  41. ^Clinick, Andrew (ngày 14 tháng 7 năm 2000). "Giới thiệu JScript .NET". Mạng lưới phát triển Microsoft. Microsoft. Được lưu trữ từ bản gốc vào ngày 10 tháng 11 năm 2017. Truy cập ngày 10 tháng 4 năm 2018. [S] Ince Giới thiệu năm 1996 của JScript phiên bản 1.0 ... Chúng ta đã thấy sự gia tăng ổn định trong việc sử dụng JScript trên máy chủ, đặc biệt là hoạt động Trang máy chủ (ASP) Clinick, Andrew (July 14, 2000). "Introducing JScript .NET". Microsoft Developer Network. Microsoft. Archived from the original on November 10, 2017. Retrieved April 10, 2018. [S]ince the 1996 introduction of JScript version 1.0 ... we've been seeing a steady increase in the usage of JScript on the server—particularly in Active Server Pages (ASP)
  42. ^ Abmahemoff, Michael (ngày 17 tháng 12 năm 2009). "JavaScript phía máy chủ, trở lại với sự báo thù". readwrite.com. Được lưu trữ từ bản gốc vào ngày 17 tháng 6 năm 2016. Truy cập ngày 16 tháng 7 năm 2016.a b Mahemoff, Michael (December 17, 2009). "Server-Side JavaScript, Back with a Vengeance". readwrite.com. Archived from the original on June 17, 2016. Retrieved July 16, 2016.
  43. ^"JavaScript cho Acrobat". Adobe.com. 2009-08-07. Được lưu trữ từ bản gốc vào ngày 7 tháng 8 năm 2009. Truy cập ngày 18 tháng 8 năm 2009. "JavaScript for Acrobat". adobe.com. 2009-08-07. Archived from the original on August 7, 2009. Retrieved August 18, 2009.
  44. ^Treitter (2013-02-02). "Trả lời câu hỏi:" Làm cách nào để phát triển một ứng dụng cho Gnome? "". LiveJournal.com. Được lưu trữ từ bản gốc vào năm 2013-02-11. Truy cập 2013-02-07. treitter (2013-02-02). "Answering the question: "How do I develop an app for GNOME?"". livejournal.com. Archived from the original on 2013-02-11. Retrieved 2013-02-07.
  45. ^"Tessel 2 ... tận dụng tất cả các thư viện của Node.js để tạo các thiết bị hữu ích trong vài phút với Tessel". Tessel.io. Được lưu trữ từ bản gốc vào ngày 2021-05-26. Truy cập 2021-05-08. "Tessel 2... Leverage all the libraries of Node.JS to create useful devices in minutes with Tessel". tessel.io. Archived from the original on 2021-05-26. Retrieved 2021-05-08.
  46. ^"Node.js Raspberry Pi Giới thiệu gpio". W3Schools.com. Được lưu trữ từ bản gốc vào ngày 2021-08-13. Truy cập 2020-05-03. "Node.js Raspberry Pi GPIO Introduction". w3schools.com. Archived from the original on 2021-08-13. Retrieved 2020-05-03.
  47. ^"Espruino & nbsp; - JavaScript cho vi điều khiển". espruino.com. Được lưu trữ từ bản gốc vào ngày 2020-05-01. Truy cập 2020-05-03. "Espruino – JavaScript for Microcontrollers". espruino.com. Archived from the original on 2020-05-01. Retrieved 2020-05-03.
  48. ^Flanagan, David (17 tháng 8 năm 2006). JavaScript: Hướng dẫn dứt khoát: Hướng dẫn dứt khoát. "O'Reilly Media, Inc.". p. & nbsp; 16. ISBN & NBSP; 978-0-596-55447-7. Được lưu trữ từ bản gốc vào ngày 1 tháng 8 năm 2020. Truy cập ngày 29 tháng 3 năm 2019. Flanagan, David (August 17, 2006). JavaScript: The Definitive Guide: The Definitive Guide. "O'Reilly Media, Inc.". p. 16. ISBN 978-0-596-55447-7. Archived from the original on August 1, 2020. Retrieved March 29, 2019.
  49. ^ Abcdkorolev, Mikhail (2019-03-01). "JavaScript Quirks trong một hình ảnh từ Internet". Cộng đồng Dev. Được lưu trữ từ bản gốc vào ngày 28 tháng 10 năm 2019. Truy cập ngày 28 tháng 10 năm 2019.a b c d Korolev, Mikhail (2019-03-01). "JavaScript quirks in one image from the Internet". The DEV Community. Archived from the original on October 28, 2019. Retrieved October 28, 2019.
  50. ^"Wat". www.destroyallsoftware.com. 2012. Lưu trữ từ bản gốc vào ngày 28 tháng 10 năm 2019. Truy cập ngày 28 tháng 10 năm 2019. "Wat". www.destroyallsoftware.com. 2012. Archived from the original on October 28, 2019. Retrieved October 28, 2019.
  51. ^"Kiểu dữ liệu JavaScript và cấu trúc dữ liệu & nbsp; - JavaScript | mdn". Nhà phát triển.mozilla.org. Ngày 16 tháng 2 năm 2017. Lưu trữ từ bản gốc vào ngày 14 tháng 3 năm 2017. Truy cập ngày 24 tháng 2 năm 2017. "JavaScript data types and data structures – JavaScript | MDN". Developer.mozilla.org. February 16, 2017. Archived from the original on March 14, 2017. Retrieved February 24, 2017.
  52. ^Flanagan 2006, trang & nbsp; 176 Từ178. Flanagan 2006, pp. 176–178.
  53. ^Crockford, Douglas. "Kế thừa nguyên mẫu trong JavaScript". Được lưu trữ từ bản gốc vào ngày 13 tháng 8 năm 2013. Truy cập ngày 20 tháng 8 năm 2013. Crockford, Douglas. "Prototypal Inheritance in JavaScript". Archived from the original on 13 August 2013. Retrieved 20 August 2013.
  54. ^"Di truyền và chuỗi nguyên mẫu". Mạng lưới nhà phát triển Mozilla. Mozilla. Được lưu trữ từ bản gốc vào ngày 25 tháng 4 năm 2013. Truy cập ngày 6 tháng 4 năm 2013. "Inheritance and the prototype chain". Mozilla Developer Network. Mozilla. Archived from the original on April 25, 2013. Retrieved April 6, 2013.
  55. ^Herman, David (2013). JavaScript hiệu quả. Addison-Wesley. p. & nbsp; 83. ISBN & NBSP; 978-0-321-81218-6. Herman, David (2013). Effective JavaScript. Addison-Wesley. p. 83. ISBN 978-0-321-81218-6.
  56. ^Haverbeke, Marijn (2011). JavaScript hùng hồn. Không có báo chí tinh bột. Trang & NBSP; 95 Từ97. ISBN & NBSP; 978-1-59327-282-1. Haverbeke, Marijn (2011). Eloquent JavaScript. No Starch Press. pp. 95–97. ISBN 978-1-59327-282-1.
  57. ^Katz, Yehuda (12 tháng 8 năm 2011). "Hiểu" nguyên mẫu "trong JavaScript". Được lưu trữ từ bản gốc vào ngày 5 tháng 4 năm 2013. Truy cập ngày 6 tháng 4 năm 2013. Katz, Yehuda (12 August 2011). "Understanding "Prototypes" in JavaScript". Archived from the original on 5 April 2013. Retrieved April 6, 2013.
  58. ^Herman, David (2013). JavaScript hiệu quả. Addison-Wesley. Trang & NBSP; 125 Từ127. ISBN & NBSP; 978-0-321-81218-6. Herman, David (2013). Effective JavaScript. Addison-Wesley. pp. 125–127. ISBN 978-0-321-81218-6.
  59. ^"Hàm & nbsp; - JavaScript". MDN Web Docs. Truy cập 2021-10-30. "Function – JavaScript". MDN Web Docs. Retrieved 2021-10-30.
  60. ^"Thuộc tính của đối tượng hàm". Es5.github.com. Được lưu trữ từ bản gốc vào ngày 28 tháng 1 năm 2013. Truy cập ngày 26 tháng 5 năm 2013. "Properties of the Function Object". Es5.github.com. Archived from the original on January 28, 2013. Retrieved May 26, 2013.
  61. ^Flanagan 2006, trang & nbsp; 141. Flanagan 2006, p. 141.
  62. ^Nhiều tài năng của JavaScript để khái quát hóa các phương pháp lập trình định hướng vai trò như các đặc điểm và mixin được lưu trữ 2017-10-05 tại Wayback Machine, peterseliger.blogpsot.de, ngày 11 tháng 4 năm 2014. The many talents of JavaScript for generalizing Role-Oriented Programming approaches like Traits and Mixins Archived 2017-10-05 at the Wayback Machine, Peterseliger.blogpsot.de, April 11, 2014.
  63. ^Đặc điểm cho JavaScript được lưu trữ 2014-07-24 tại Wayback Machine, 2010. Traits for JavaScript Archived 2014-07-24 at the Wayback Machine, 2010.
  64. ^"Trang chủ | cocktailjs". Cocktailjs.github.io. Được lưu trữ từ bản gốc vào ngày 4 tháng 2 năm 2017. Truy cập ngày 24 tháng 2 năm 2017. "Home | CocktailJS". Cocktailjs.github.io. Archived from the original on February 4, 2017. Retrieved February 24, 2017.
  65. ^Angus Croll, một cái nhìn mới về JavaScript Mixins đã lưu trữ 2020-04-15 tại Wayback Machine, xuất bản ngày 31 tháng 5 năm 2011. Angus Croll, A fresh look at JavaScript Mixins Archived 2020-04-15 at the Wayback Machine, published May 31, 2011.
  66. ^"Mô hình đồng thời và vòng lặp sự kiện". Mạng lưới nhà phát triển Mozilla. Được lưu trữ từ bản gốc vào ngày 5 tháng 9 năm 2015. Truy cập ngày 28 tháng 8 năm 2015. "Concurrency model and Event Loop". Mozilla Developer Network. Archived from the original on September 5, 2015. Retrieved August 28, 2015.
  67. ^Haverbeke, Marijn (2011). JavaScript hùng hồn. Không có báo chí tinh bột. Trang & NBSP; 139 Từ149. ISBN & NBSP; 978-1-59327-282-1. Haverbeke, Marijn (2011). Eloquent JavaScript. No Starch Press. pp. 139–149. ISBN 978-1-59327-282-1.
  68. ^"E4X - Lưu trữ nội dung lỗi thời | mdn". Mạng lưới nhà phát triển Mozilla. Quỹ Mozilla. Ngày 14 tháng 2 năm 2014. Lưu trữ từ bản gốc vào ngày 24 tháng 7 năm 2014. Truy cập ngày 13 tháng 7 năm 2014. "E4X – Archive of obsolete content | MDN". Mozilla Developer Network. Mozilla Foundation. February 14, 2014. Archived from the original on July 24, 2014. Retrieved July 13, 2014.
  69. ^"Var - JavaScript - mdn". Mạng lưới nhà phát triển Mozilla. Được lưu trữ từ bản gốc vào ngày 23 tháng 12 năm 2012. Truy cập ngày 22 tháng 12 năm 2012. "var – JavaScript – MDN". The Mozilla Developer Network. Archived from the original on December 23, 2012. Retrieved December 22, 2012.
  70. ^"Hãy". MDN Web Docs. Mozilla. Được lưu trữ từ bản gốc vào ngày 28 tháng 5 năm 2019. Truy cập ngày 27 tháng 6 năm 2018. "let". MDN web docs. Mozilla. Archived from the original on May 28, 2019. Retrieved June 27, 2018.
  71. ^"const". MDN Web Docs. Mozilla. Được lưu trữ từ bản gốc vào ngày 28 tháng 6 năm 2018. Truy cập ngày 27 tháng 6 năm 2018. "const". MDN web docs. Mozilla. Archived from the original on June 28, 2018. Retrieved June 27, 2018.
  72. ^"Đặc điểm kỹ thuật ngôn ngữ Ecmascript-Phiên bản ECMA-262 5.1". Ecma International. Được lưu trữ từ bản gốc vào ngày 26 tháng 11 năm 2012. Truy cập ngày 22 tháng 12 năm 2012. "ECMAScript Language Specification – ECMA-262 Edition 5.1". Ecma International. Archived from the original on November 26, 2012. Retrieved December 22, 2012.
  73. ^"Bảng điều khiển". Mạng lưới nhà phát triển Mozilla. Mozilla. Được lưu trữ từ bản gốc vào ngày 28 tháng 2 năm 2013. Truy cập ngày 6 tháng 4 năm 2013. "console". Mozilla Developer Network. Mozilla. Archived from the original on February 28, 2013. Retrieved April 6, 2013.
  74. ^"lập luận". Mạng lưới nhà phát triển Mozilla. Mozilla. Được lưu trữ từ bản gốc vào ngày 13 tháng 4 năm 2013. Truy cập ngày 6 tháng 4 năm 2013. "arguments". Mozilla Developer Network. Mozilla. Archived from the original on April 13, 2013. Retrieved April 6, 2013.
  75. ^"Hàm* - JavaScript | mdn". nhà phát triển.mozilla.org. Truy cập 2022-09-27. "function* - JavaScript | MDN". developer.mozilla.org. Retrieved 2022-09-27.
  76. ^"Mô -đun JavaScript". MDN Web Docs. Mozilla. Được lưu trữ từ bản gốc vào ngày 17 tháng 7 năm 2022. Truy cập ngày 28 tháng 7 năm 2022. "JavaScript modules". MDN Web Docs. Mozilla. Archived from the original on 17 July 2022. Retrieved 28 July 2022.
  77. ^"Làm cho JavaScript an toàn cho quảng cáo". ADSAFE. Được lưu trữ từ bản gốc vào ngày 2021-07-06. Truy cập 2021-05-08. "Making JavaScript Safe for Advertising". ADsafe. Archived from the original on 2021-07-06. Retrieved 2021-05-08.
  78. ^"Kịch bản ECMA an toàn (SES)". Được lưu trữ từ bản gốc vào ngày 15 tháng 5 năm 2013. Truy cập ngày 26 tháng 5 năm 2013. "Secure ECMA Script (SES)". Archived from the original on May 15, 2013. Retrieved May 26, 2013.
  79. ^"Dự án Google Caja". Google. Được lưu trữ từ bản gốc vào ngày 2021-01-22. Truy cập 2021-07-09. "Google Caja Project". Google. Archived from the original on 2021-01-22. Retrieved 2021-07-09.
  80. ^"Các lỗ hổng kịch bản chéo Mozilla được báo cáo và cố định & nbsp;-mozillazine talkback". Mozillazine.org. Được lưu trữ từ bản gốc vào ngày 21 tháng 7 năm 2011. Truy cập ngày 24 tháng 2 năm 2017. "Mozilla Cross-Site Scripting Vulnerability Reported and Fixed – MozillaZine Talkback". Mozillazine.org. Archived from the original on July 21, 2011. Retrieved February 24, 2017.
  81. ^Kottelin, Thor (17 tháng 6 năm 2008). "Nhấp chuột phải vào" Bảo vệ "? Quên về nó". Blog.anta.net. Được lưu trữ từ bản gốc vào ngày 28 tháng 7 năm 2022. Truy cập ngày 28 tháng 7 năm 2022. Kottelin, Thor (17 June 2008). "Right-click "protection"? Forget about it". blog.anta.net. Archived from the original on 28 July 2022. Retrieved 28 July 2022.
  82. ^Rehorik, tháng 1 (29 tháng 11 năm 2016). "Tại sao bạn không bao giờ nên đặt dữ liệu nhạy cảm vào JavaScript của mình". Blog ServiceObjects. ServiceObjects. Được lưu trữ từ bản gốc vào ngày 3 tháng 6 năm 2019. Truy cập ngày 3 tháng 6 năm 2019. Rehorik, Jan (29 November 2016). "Why You Should Never Put Sensitive Data in Your JavaScript". ServiceObjects Blog. ServiceObjects. Archived from the original on June 3, 2019. Retrieved June 3, 2019.
  83. ^ ablauinger, Tobias; Chaabane, Abdelberi; Arshad, Sajjad; Robertson, William; Wilson, Christo; Kirda, Engin (ngày 21 tháng 12 năm 2016). Ngươi không phụ thuộc vào tôi: Phân tích việc sử dụng các thư viện JavaScript lỗi thời trên web (PDF). Đại học Northeastern. Arxiv: 1811.00918. doi: 10.14722/ndss.2017.23414. ISBN & NBSP; 978-1-891562-46-4. S2CID & NBSP; 17885720. Được lưu trữ từ bản gốc (PDF) vào ngày 29 tháng 3 năm 2017. Truy cập ngày 28 tháng 7 năm 2022.a b Lauinger, Tobias; Chaabane, Abdelberi; Arshad, Sajjad; Robertson, William; Wilson, Christo; Kirda, Engin (December 21, 2016). Thou Shalt Not Depend on Me: Analysing the Use of Outdated JavaScript Libraries on the Web (PDF). Northeastern University. arXiv:1811.00918. doi:10.14722/ndss.2017.23414. ISBN 978-1-891562-46-4. S2CID 17885720. Archived from the original (PDF) on 29 March 2017. Retrieved 28 July 2022.
  84. ^Collins, Keith (ngày 27 tháng 3 năm 2016). "Làm thế nào một lập trình viên đã phá vỡ Internet bằng cách xóa một đoạn mã nhỏ". Quartz. Được lưu trữ từ bản gốc vào ngày 22 tháng 2 năm 2017. Truy cập ngày 22 tháng 2 năm 2017. Collins, Keith (March 27, 2016). "How one programmer broke the internet by deleting a tiny piece of code". Quartz. Archived from the original on February 22, 2017. Retrieved February 22, 2017.
  85. ^Tạp chí SC UK, 11 dòng mã bị xóa 'Breaking the Internet' được lưu trữ vào ngày 23 tháng 2 năm 2017, tại Wayback Machine SC Magazine UK, Developer's 11 lines of deleted code 'breaks the internet' Archived February 23, 2017, at the Wayback Machine
  86. ^Mozilla Corporation, Buffer Overflow trong Crypto.SignText () Lưu trữ 2014-06-04 tại Wayback Machine Mozilla Corporation, Buffer overflow in crypto.signText() Archived 2014-06-04 at the Wayback Machine
  87. ^Festa, Paul (ngày 19 tháng 8 năm 1998). "Lỗi bộ đệm trong IE". CNET. Được lưu trữ từ bản gốc vào ngày 25 tháng 12 năm 2002. Festa, Paul (August 19, 1998). "Buffer-overflow bug in IE". CNET. Archived from the original on December 25, 2002.
  88. ^Bảo mậtTracker.com, Buffer JavaScript Apple Safari cho phép người dùng từ xa thực thi mã tùy ý và lỗi chuyển hướng HTTP cho phép người dùng từ xa truy cập các tệp được lưu trữ 2010-02-18 SecurityTracker.com, Apple Safari JavaScript Buffer Overflow Lets Remote Users Execute Arbitrary Code and HTTP Redirect Bug Lets Remote Users Access Files Archived 2010-02-18 at the Wayback Machine
  89. 4 SecurityFocus, Microsoft WebViewFolderIcon ActiveX Control Buffer Overflow Vulnerability Archived 2011-10-11 at the Wayback Machine
  90. ^Cơ quan Fusion, Macromedia Flash ActiveX tràn được lưu trữ vào ngày 13 tháng 8 năm 2011, tại Wayback Machine Fusion Authority, Macromedia Flash ActiveX Buffer Overflow Archived August 13, 2011, at the Wayback Machine
  91. ^"Chế độ được bảo vệ trong Vista IE7 - Ieblog". Blog.msdn.com. Ngày 9 tháng 2 năm 2006. Lưu trữ từ bản gốc vào ngày 23 tháng 1 năm 2010. Truy cập ngày 24 tháng 2 năm 2017. "Protected Mode in Vista IE7 – IEBlog". Blogs.msdn.com. February 9, 2006. Archived from the original on January 23, 2010. Retrieved February 24, 2017.
  92. ^Hoa Kỳ Chứng chỉ, Khả năng dễ bị tổn thương VU#713878: Microsoft Internet Explorer không xác nhận đúng nguồn của khung được chuyển hướng lưu trữ 2009-10-30 tại Wayback Machine US CERT, Vulnerability Note VU#713878: Microsoft Internet Explorer does not properly validate source of redirected frame Archived 2009-10-30 at the Wayback Machine
  93. ^Mozilla Foundation, Mozilla Foundation Advisory 2005 Từ41: Tăng đặc quyền thông qua tài sản DOM ghi đè Mozilla Foundation, Mozilla Foundation Security Advisory 2005–41: Privilege escalation via DOM property overrides Archived 2014-06-04 at the Wayback Machine
  94. ^Andersen, Starr (2004-08-09). "Phần 5: Bảo mật duyệt web nâng cao". Technet. Tài liệu Microsoft. Thay đổi chức năng trong gói dịch vụ Windows XP 2. Truy cập 2021-10-20. Andersen, Starr (2004-08-09). "Part 5: Enhanced Browsing Security". TechNet. Microsoft Docs. Changes to Functionality in Windows XP Service Pack 2. Retrieved 2021-10-20.
  95. ^Để biết một ví dụ về một con ngựa Trojan JavaScript hiếm For one example of a rare JavaScript Trojan Horse, see Symantec Corporation, JS.Seeker.K Archived 2011-09-13 at the Wayback Machine
  96. ^Gruss, Daniel; Maurice, Clémentine; Manggard, Stefan (ngày 24 tháng 7 năm 2015). "Rowhammer.js: Một cuộc tấn công lỗi do phần mềm từ xa trong JavaScript". ARXIV: 1507.06955 [CS.CR]. Gruss, Daniel; Maurice, Clémentine; Mangard, Stefan (July 24, 2015). "Rowhammer.js: A Remote Software-Induced Fault Attack in JavaScript". arXiv:1507.06955 [cs.CR].
  97. ^Jean-Pharun, Alix (ngày 30 tháng 7 năm 2015). "Rowhammer.js là hack khéo léo nhất mà tôi từng thấy". Bo mạch chủ. Hành vi xấu xa. Được lưu trữ từ bản gốc vào ngày 27 tháng 1 năm 2018. Truy cập ngày 26 tháng 1 năm 2018. Jean-Pharuns, Alix (July 30, 2015). "Rowhammer.js Is the Most Ingenious Hack I've Ever Seen". Motherboard. Vice. Archived from the original on January 27, 2018. Retrieved January 26, 2018.
  98. ^Goodin, Dan (ngày 4 tháng 8 năm 2015). "DRAM 'Bitflipping' khai thác để tấn công PCS: Chỉ cần thêm JavaScript". ARS Technica. Được lưu trữ từ bản gốc vào ngày 27 tháng 1 năm 2018. Truy cập ngày 26 tháng 1 năm 2018. Goodin, Dan (August 4, 2015). "DRAM 'Bitflipping' exploit for attacking PCs: Just add JavaScript". Ars Technica. Archived from the original on January 27, 2018. Retrieved January 26, 2018.
  99. ^Auerbach, David (ngày 28 tháng 7 năm 2015). "Rowhammer Security khai thác: Tại sao một cuộc tấn công bảo mật mới thực sự đáng sợ". Slate.com. Được lưu trữ từ bản gốc vào ngày 30 tháng 7 năm 2015. Truy cập ngày 29 tháng 7 năm 2015. Auerbach, David (July 28, 2015). "Rowhammer security exploit: Why a new security attack is truly terrifying". slate.com. Archived from the original on July 30, 2015. Retrieved July 29, 2015.
  100. ^ANC được lưu trữ 2017-03-16 tại Wayback Machine Vusec, 2017 AnC Archived 2017-03-16 at the Wayback Machine VUSec, 2017
  101. ^JavaScript mới của ASLR-Busting sắp sửa khai thác Drive-by nhiều khả năng lưu trữ khó khăn hơn nhiều 2017-03-16 tại Wayback Machine Ars Technica, 2017 New ASLR-busting JavaScript is about to make drive-by exploits much nastier Archived 2017-03-16 at the Wayback Machine Ars Technica, 2017
  102. ^Cuộc tấn công Spectre đã lưu trữ 2018-01-03 tại Wayback Machine Spectre Attack Spectre Attack Archived 2018-01-03 at the Wayback Machine Spectre Attack
  103. ^"Điểm chuẩn.js". Điểm chuẩn.com. Được lưu trữ từ bản gốc vào năm 2016-12-19. Truy cập 2016-11-06. "Benchmark.js". benchmarkjs.com. Archived from the original on 2016-12-19. Retrieved 2016-11-06.
  104. ^Jsben.ch. "JSBEN.CH hiệu suất điểm chuẩn Sân chơi cho JavaScript". JSBEN.CH. Được lưu trữ từ bản gốc vào ngày 2021-02-27. Truy cập 2021-08-13. JSBEN.CH. "JSBEN.CH Performance Benchmarking Playground for JavaScript". jsben.ch. Archived from the original on 2021-02-27. Retrieved 2021-08-13.
  105. ^Eich, Brendan (ngày 3 tháng 4 năm 2008). "Phổ biến". Được lưu trữ từ bản gốc vào ngày 3 tháng 7 năm 2011. Truy cập ngày 19 tháng 1 năm 2012. Eich, Brendan (April 3, 2008). "Popularity". Archived from the original on July 3, 2011. Retrieved January 19, 2012.
  106. ^"TypeScript: JavaScript có cú pháp cho các loại". TypeScriptlang.org. Truy cập 2022-08-12. "TypeScript: JavaScript With Syntax For Types". Typescriptlang.org. Retrieved 2022-08-12.
  107. ^"Trình duyệt Edge chuyển WebAssugging thành 'ON' - Tạp chí Visual Studio". Tạp chí Visual Studio. Được lưu trữ từ bản gốc vào năm 2018-02-10. Truy cập 2018-02-09. "Edge Browser Switches WebAssembly to 'On' -- Visual Studio Magazine". Visual Studio Magazine. Archived from the original on 2018-02-10. Retrieved 2018-02-09.
  108. ^"Câu hỏi thường gặp". ASM.JS. Được lưu trữ từ bản gốc vào ngày 4 tháng 6 năm 2014. Truy cập ngày 13 tháng 4 năm 2014. "frequently asked questions". asm.js. Archived from the original on June 4, 2014. Retrieved April 13, 2014.

Đọc thêm [Chỉnh sửa][edit]

  • Flanagan, David. JavaScript: Hướng dẫn dứt khoát. Phiên bản thứ 7. Sebastopol, California: O'Reilly, 2020.
  • Haverbeke, Marijn. JavaScript hùng hồn. Ấn bản thứ 3. Không có báo chí tinh bột, 2018. 472 trang. ISBN & NBSP; 978-1593279509. (Tải xuống)
  • Zakas, Nicholas. Nguyên tắc của JavaScript hướng đối tượng, Phiên bản 1. Không có báo chí tinh bột, 2014. 120 trang. ISBN & NBSP; 978-1593275402.

Liên kết bên ngoài [Chỉnh sửa][edit]

Hướng dẫn what was the first name of javascript - tên đầu tiên của javascript là gì

Tệp âm thanh này được tạo từ bản sửa đổi của bài viết này ngày 20 & nbsp; August & NBSP; 2013 và không phản ánh các chỉnh sửa tiếp theo.

  • JavaScript tại Curlie
  • "JavaScript: 20 năm đầu tiên". Truy cập 2022-02-06.. Retrieved 2022-02-06.

JavaScript được đặt tên như thế nào?

Các phiên bản đầu của JavaScript được gọi là Mocha. Không lâu sau khi một nguyên mẫu Mocha được đưa vào NetScape Communicator (tháng 5 năm 1995), nó được đổi tên thành Livescript, hoàn toàn vì thế giới sống tốt hơn để tiếp thị. Nó được đổi tên lại vào tháng 12 cùng năm, lần này là JavaScript.

Tên khác của JavaScript là gì?

"Ecmascript" là thuật ngữ cho tiêu chuẩn ngôn ngữ, nhưng "ecmascript" và "javascript" có thể được sử dụng thay thế cho nhau.Ngôn ngữ cốt lõi này cũng được sử dụng trong môi trường không phải trình duyệt, ví dụ trong nút.JS.ECMAScript" is the term for the language standard, but "ECMAScript" and "JavaScript" can be used interchangeably. This core language is also used in non-browser environments, for example in Node. js.

Có phải JavaScript được gọi là Mocha?

JavaScript ban đầu được phát triển bởi Brendan Eich của Netscape Communications Corporation dưới cái tên Mocha, sau đó là Livescript, và cuối cùng được đổi tên thành JavaScript., then LiveScript, and finally renamed to JavaScript.

Tên ban đầu của JavaScript Livescript Escript Mocha JavaScript là gì?

Ban đầu, nó không được gọi là JavaScript;Nó đã được đặt tên là Mocha.Cái tên Mocha được chọn bởi Marc Andreessen, một người sáng lập Netscape.Cái tên được đổi thành Livescript vào tháng 9 năm 1995. Trong cùng năm, tháng 12, nó đã nhận được giấy phép nhãn hiệu từ Sun và cái tên JavaScript xuất hiện trong bức tranh.Mocha. The name Mocha was chosen by Marc Andreessen, a Netscape founder. The name was changed to LiveScript in September 1995. In the same year, December, it received a trademark license from Sun and the name JavaScript came into the picture.