Foreword: For many front ends, the relationship between JavaScript and them is mutually fulfilling.

About the prehistory of JS

Born ~

JavaScript (often abbreviated JS) is a high-level, interpreted programming language. JavaScript is a prototype-based, first-class function language, a multi-paradigm language that supports object-oriented programming, imperative programming, and functional programming. It provides syntax to manipulate text, arrays, dates, regular expressions, etc. It does not support I/O, such as networking, storage, graphics, etc., but these can be supported by its host environment.

Some details

  • In 1993, the National Center for Supercomputer Applications (NCSA) published NCSA Mosaic, the first popular graphical interface web browser, which played an important role in popularizing the World Wide Web.

  • In 1994, Mosaic’s main developers immediately founded Netscape and hired many of the original NCSA Mosaic developers to develop Netscape Navigator. The company’s goal was to replace NCSA Mosaic as the world’s number one web browser.

  • Within four months, it had captured three-quarters of the browser market and became the dominant browser on the Internet in the 1990s.

  • Netscape foresaw that the web needed to become more dynamic. Marc Andreessen, the company’s founder, thought HTML needed a glue language that web designers and part-time programmers could easily use to assemble components like images and plug-ins, and code that could be written directly into web markup.

  • In 1995, Netscape recruited Brandon Eck with the goal of embedding the Scheme language into Netscape Navigator. Netscape’s decision to invent an auxiliary scripting language that works with Java and is syntactically similar led to the exclusion of existing languages such as Perl, Python, Tcl, or Scheme. To defend the idea of JavaScript against other competing proposals, companies need to have a working prototype. Ike created the prototype in just ten days in May 1995.

10 days to write the language? Choose the best and be bold

Brendan Eich, a 34-year-old systems programmer, has no interest in the JAVA language at all. Brendan Eich’s primary interest is functional programming, and netscape recruited him to investigate the possibility of using the Scheme language as a web scripting language. Brendan Eich himself felt the same way, assuming that he would be working primarily with Scheme when he arrived at his new company. So basically Brendan Eich wrote along these lines

(1) Learn from the basic syntax of C language;

(2) Use the Java language for data types and memory management;

(3) Using Scheme language to upgrade functions to the status of “First class”;

(4) Use Self language for reference and inheritance mechanism based on prototype.

The problem with haphazard writing is that it’s not very good

  • Ruan summed up 10 design defects in the back, here I simply list

1. Not suitable for developing large programs

Javascript has no namespace and is difficult to modularize; There is no specification for how to distribute code across multiple files; Allows for duplicate definitions of functions with the same name, with the latter overwriting the previous, making modular loading difficult.

2. Very small standard libraries

The standard library of functions provided by Javascript is very small and can only do a few basic operations, with many functions lacking.

3. The null, and undefined

4. Global variables are difficult to control

Javascript global variables, visible in all modules; Global variables can be generated inside any function, which greatly increases the complexity of the program.

5. Automatically insert semicolons at the end of lines

All Javascript statements must end with a semicolon. However, if you forget to add a semicolon, the interpreter does not report an error, but automatically adds a semicolon for you. Sometimes, this leads to errors that are hard to spot.

6. The plus operator

As an operator, the + sign has two meanings. It can represent the sum of numbers or the concatenation of characters.

7. NaN

NaN is a number that indicates that the interpreter has exceeded its limits. It has some very strange properties:

8. Distinction between arrays and objects

Since Javascript arrays are objects, it can be tricky to tell whether an object is an array or not.

9. = = and = = =

== is used to determine whether two values are equal. When two value types are different, an automatic conversion occurs, and the result is very counterintuitive.

10. Wrapper objects of basic types

Javascript has three basic data types: strings, numbers, and Booleans. They all have constructors that generate string objects, number objects, and Booleans. The object types that correspond to the base data types are of little use but of great confusion.

  • For more details, please click on teacher Ruan Yifeng’s article

So casual language, how can become so popular now appearance?

In a word: “Standing on the draught, pigs can fly”

What did JS catch?

  • The first was to standardize my language.

That is to say, when I make myself a standard, I realize the possibility of batch copying myself

In November 1996, Netscape formally submitted language standards to ECMA (European Computer Manufacturers Association). In June 1997, ECMA developed the ECMAScript standard specification ECMA-262 based on the JavaScript language. JavaScript has become one of the best-known implementations of ECMAScript. In addition, ActionScript and JScript are also the implementation languages of the ECMAScript specification. Although JavaScript is promoted and advertised as a scripting language for non-programmers, rather than as a scripting language for programmers, JavaScript is very rich in features.

  • Then Gmail made the browser do more than just surf the web online

2004: Google announced Gmail. Gmail is an online web page developed by Google with the ability to send and receive emails. Before Gmail, everyone thought browsers were just for browsing and reading. But Gmail has reintroduced users to what a browser can do.

In 2005, Jesse named The technology Google used to implement Gmail AJAX. This is where front-end technology comes in.

JQuery was released in 2006. JQuery is the longest-lived JS library. It is mainly compatible with Internet Explorer, but with the fall of Internet Explorer, JQuery has gradually faded from the front end developers’ view.

  • Then, when the trend of mobile is all the rage, it shows a good lightweight fit

The iPhone4 was released in 2010, heralding the advent of the smartphone era. But Internet Explorer is not supported on either IOS (Safari) or Android (Chrome). At the same time, there has been some differentiation between mobile and PC.

For example, When Steve Jobs created the iPhone, he said, “Flash is not supported by IOS system.” As a result, Flash can only rely on Android in the mobile market, but its performance in Android system is not satisfactory. The service was finally discontinued in 2020. This story tells us that only running services on the PC end is not the demand of the majority of Internet users, and the convenience and speed of the mobile end has been achieved “user cultivation”.

Microsoft joined forces with Nokia, but eventually Nokia failed in the mobile phone industry and Microsoft acquired the mobile phone business. It’s safe to assume that Internet Explorer is almost invisible on mobile phones.

At this point, front-end developers can no longer need to consider the needs of IE users, get rid of IE dominated by the day, the front end from the rapid development.

  • Finally, Node.js really expands the boundaries of front-end engineering

In 2009, Ryan created Node.js based on V8; In 2010 Issac wrote NPM based on Node.js. With Node.js, front-end engineers implement js execution outside of the browser.

In 2010, TJ released Express.js, inspired by Sinatra. Node.js and Express.js allow the front end engineer to complete the back end. It’s not quite Java, but at least it has the means.

What standards are you talking about?

ECMAScript standard

  • In June 1997, the first version of ECMAScript was released.

  • In December 1999, ECMAScript version 3 was released, which is the most widely used version of ECMAScript.

  • The fourth edition of abortion.

  • ECMAScript 5 was released in December 2005, 10 years after the release of version 3 (IE 6 was in its heyday).

  • With the rise of Chrome, these new browser JS engines are implemented according to the ECMAScript standard. So with the exception of Internet Explorer, compatibility between browsers has been greatly improved.

  • In June 2015, ECMAScript Version 6 (ES6) was released. And released it every year after that. Visible JS status in the continuous improvement.

  • The difference between vaScript and ECMAScript is that ECMAScript is a standard, while JavaScript is an implementation (actually JavaScript is composed of ECMAScript, DOM and BOM). The functions implemented may not appear in the standard. Different browsers also have their own unique JS implementations. (Consider whether to add the implementation to the standard first)

Can you show me exactly what this standard looks like?

Line!!!!!!

In general, complete JavaScript consists of the following parts:

  • ECMAScript, which describes the syntax and basic objects of the language
  • Document Object Model (DOM), which describes methods and interfaces for handling web page content
  • The Browser Object Model (BOM), which describes the methods and interfaces for interacting with the browser

The basic features of JavaScript are as follows:

  • Is an interpreted scripting language (code is not precompiled).
  • It is used to add interactive behavior to HTML pages.
  • You can embed it directly into an HTML page, but writing it as a separate JS file helps separate structure from behavior.

JavaScript is commonly used to accomplish the following tasks:

  • Embed dynamic text in HTML pages
  • Responds to browser events
  • Reading and writing HTML elements
  • Validate data before it is submitted to the server
  • Detect the visitor’s browser information
  • Control cookies, including creation and modification