A brief introduction to "JavaScript Breakthrough"

Source: Internet
Author: User
Tags hosting

JavaScript is a Web-oriented programming language, and most modern Web sites use JavaScript, and all modern web browsers (computers, mobile phones, tablets) contain JavaScript interpreters. This allows JavaScript to be called the most widely used programming language in history. JavaScript is also one of three skills that front-end developers must master: HTML that describes the content of the Web page, CSS that describes the style of the page, and JavaScript that describes the behavior of the Web page.

JavaScript is a dynamic, weakly-typed, object-oriented, interpreted programming language that is ideal for object-oriented and functional programming styles. The syntax of JavaScript comes from Java, its first-class function is derived from Scheme, and its prototype-based (prototype-based) inheritance comes from self. However, this course does not have to be understood (Java/scheme/slef) or familiar with those terms.

JavaScript origins

Date: 1995

People: Brendan Eich (Brandon Aichi)

Background: At that time, the vast majority of Internet users are using speed only 28.8kbit/s "cat" internet, in order to complete the simple form verification, the form data must be sent to the server side to determine whether the user has not filled out a required field, entered an invalid value, Each operation will have to wait more than 30 seconds to have results, which is undoubtedly in the chronic suicide.

Event: The Netscape company, which was at the forefront of technological innovation, assigned Brendan Eich to develop a client language to handle this simple validation, which is JavaScript. JavaScript formerly known as Livescript,netscape in order to catch the media stir Java's ride, just renamed LiveScript JavaScript. (so the relationship between Java and JavaScript is the equivalent of Lei Feng and Leifeng Pagoda.) )

Since then, JavaScript has become a feature of common browser prerequisites on the market. Today, JavaScript is no longer confined to simple data validation, but has the ability to interact with almost all aspects of the browser window and its content. Today's JavaScript has become a full-fledged programming language capable of handling complex computations and interactions, with features such as closures, anonymous (lambda, lambda) functions, and even meta-programming.

JavaScript has evolved from a simple input validator to a powerful programming language, completely unexpected. It should be said that it is not only a very simple language, but also a very complex language. It's simple because it takes a moment to learn to use it, and it's complicated because it takes years to really master it.

JavaScript implementation

With the advent of JavaScript, Microsoft also added a JavaScript implementation called JScript in IE, because there is no standard specification for JavaScript syntax and features, resulting in multiple versions of JavaScript on the market, and are incompatible with each other, So the JavaScript standardization issue was put on the agenda.

In 1997, the European Association of Computer Manufacturers (Ecma,european Computer manufactures association) defined a scripting language standard called ECMAScript (pronounced ek-ma-script ), which is generic, Platform-independent language standards. Since then, browser developers have been working on ECMAScript as the basis for their respective JAVASCRIPT implementations. Although the foundation is the same, the implementation is slightly different across browsers.

JavaScript and ECMAScript are often used to express the same meaning, but JavaScript has more meaning than ECMAScript. A complete JavaScript implementation should consist of the following three different parts.

    • Core (ECMAScript)
    • Document Object Model (DOM)
    • Browser object Model (BOM)
Core (ECMAScript)

The ECMAScript standard consists of syntax, data types, statements, keywords, reserved words, operators, and objects . It does not have any dependencies on the Web browser, and the language itself does not contain input and output definitions. ECMAScript defines only the basis of this language, and on top of that it builds a more complete scripting language.

Web browsers are just one of the hosting environments implemented by ECMAScript, and other hosting environments include Node and Adobe Flash. The hosting environment not only provides a basic ECMAScript implementation, but also provides extensions to the language (for example, DOM, BOM), which use the core types and syntax of ECMAScript to provide more specific functionality.

JavaScript is the Web browser's implementation of the ECMAScript standard , and ActionScript is the Adobe Flash implementation of the ECMAScript standard.

ECMAScript history

1997, ECMAScript 1 release.

June 1998, ECMAScript 2 release.

December 1999, ECMAScript 3 release.

In 2000, ECMAScript 4 began brewing, and eventually this version did not pass.

December 2009, ECMAScript 5 release.

In June 2011, the ECMAscript 5.1 edition was released as an international standard.

In June 2015, ECMAScript 6 was formally adopted as an international standard.

Expand reading "Nanyi's ECMAScript 6"
http://es6.ruanyifeng.com/#docs/intro

Version 3.0 is a huge success, in the industry has been widely supported, become the standard, the basic syntax of the JavaScript language, the future version of the full inheritance. Until today, beginners began to learn JavaScript, is actually learning 3.0 version of the grammar.

Document Object Model (DOM)

The Document Object model (Dom,document object models) is an application programming interface (API) for HTML that maps the entire page to a multi-tiered node structure. Each component of an HTML page is a node of a certain type, and these nodes contain different types of data. Look at the following HTML page:

<html>    <head>        <title>Sample Page</title>    </head>    <body>        <p>Hello World!</p>    </body></html>

This tree-shaped representation of the document, created by DOM, provides the developer with the initiative to control the content and structure of the page. With the API provided by the DOM, developers can easily delete, add, replace, or modify any node.

Because Netscape and Microsoft are not compatible with the DOM, the World Wide Web Consortium, www Alliance, which is responsible for developing web communications standards, has begun to plan the DOM.

DOM Level 1:
    • DOM Core: Maps the document structure, simplifying operation and access to any part of the document.
    • Dom HTML: Based on the DOM core, added objects and methods for HTML.
DOM Level 2:
    • DOM view: Defines an interface for tracking different document views.
    • DOM event: An interface that defines event and event handling.
    • DOM style: Defines an interface that applies styles to elements based on CSS.
    • DOM traversal and scoping: Defines the interfaces that traverse and manipulate the document tree.
DOM Level 3:
    • DOM loading and Saving: introduces methods for loading and saving documents in a uniform manner.
    • DOM Validation: New ways to validate documents.
    • DOM core extension.

Attention:
1. Dom is not intended for JavaScript only, and many other languages implement DOM as well.
2. The DOM level 0 standard does not exist, it is only a reference point in the Dom's historical coordinates.

Browser object Model (BOM)

The browser object model (Bom,browser) is an application programming interface (API) for the browser that maps the entire browser window to an object. Fundamentally, the BOM only handles browser windows and frames, but it is customary to count all browser-specific JavaScript extensions as part of the BOM, such as:

    • The ability to pop up a new browser window.
    • The ability to move, zoom, and close the browser window.
    • A Navigator object that provides browser details.
    • A Localtion object that provides detailed information about the page loaded by the browser.
    • A screen object that provides detailed information about the user's display resolution.
    • Support for cookies.
    • Custom objects such as the ActiveXObject of XMLHttpRequest and IE.

BOM the most headache is no relevant norms and standards, each browser has a unique implementation, the problem is resolved in HTML5, HTML5 is committed to the many BOM functions written to the formal specifications.

Summary

JavaScript is a scripting language designed for Web page interaction and consists of the following 3 different parts:

    • Core (ECMAScript), defined by ECMA-262, provides core language functionality.
    • The Document Object Model (DOM), which provides methods and interfaces for accessing and manipulating Web page content.
    • A Browser object model (BOM) that provides methods and interfaces for interacting with the browser.

The 3 components of JavaScript are supported in varying degrees in the current 5 major browsers (IE, FireFox, Chrome, Safari, and Opera). Of these, all browsers support the ECMAScript 3 version largely well, while the support for ECMAScript 5 is increasing, but the support for DOM is much different from each other. For BOMs that have been formally incorporated into the HTML5 standard, although each browser implements some well-known common features, other features may vary by browser.

Extended reading "standard ECMA-262 5.1 edition"
Http://www.ecma-international.org/ecma-262/5.1/

Extended reading "ecmascript 5 browser compatibility Checklist"
Http://caniuse.mojijs.com/Home/Html/item/key/es5/index.html

References, errata and questions

This article is mainly based on the following books, if you need to know more details, you can check the original.

JavaScript Definitive Guide (6th edition) https://book.douban.com/subject/10549733/
JavaScript Advanced Programming (3rd edition) https://book.douban.com/subject/10546125/

For the latest updates on the course, this project is available on GitHub Star.

Https://github.com/stone0090/javascript-lessons

If you find an error while studying this course, or want to mention technical questions about the course, you can contact me in the following ways or leave a message in the "Shijia blog" of the public.

Blog:http://shijiajie.com/about
Email:[email protected]

A brief introduction to "JavaScript Breakthrough"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.