What is JavaScript?

JavaScript is a lightweight scripting language. The so-called “script language” means that it does not have the ability to develop an operating system, but is only used to write “scripts” that control other large applications (such as browsers).
JavaScript is also an embedded language. The core syntax it provides itself is not much, and it can only be used to do some mathematical and logical operations. JavaScript itself does not provide any API related to I/O, but depends on the host environment (host), so JavaScript is only suitable for embedding in a larger application environment to call the underlying API provided by the host environment.
At present, there are many host environments that have embedded JavaScript. The most common environment is the browser, and there is also the server environment, that is, the Node project.
The core syntax part of JavaScript is quite compact, including only two parts: basic syntax constructs (such as operators, control structures, statements) and the standard library (that is, a series of objects with various functions such as Array, Date, Math, etc.). In addition to this, various hosting environments provide additional APIs (i.e. interfaces that can only be used in that environment) for JavaScript calls. Taking the browser as an example, the additional APIs it provides can be divided into three categories.

  • Browser control class: operate the browser.
  • DOM classes: Manipulate various elements of a web page.
  • Web class: implement various functions of the Internet.

This article mainly introduces the basic knowledge of JavaScript core syntax and browser web development, and does not involve Node. The introduction can be divided into the following four parts.

  • Basic grammar
  • Standard library
  • Browser API
  • DOM

There are several versions of the JavaScript language. The content of this article is mainly based on ECMAScript version 5.1, which is the basis for learning JavaScript syntax.