JavaScript language overview - JavaScript | MDN

developer.mozilla.org

Tin mới

the previous section

Variables in JavaScript are declared using one of three keywords: let, const, or var.

double-equals operator

JavaScript's numeric operators include +, -, *, /, % (remainder), and ** (exponentiation). Values are assigned using =. Each binary operator also has a compound assignment counterpart such as += and -=, which extend out

reference page for lexical grammar

JavaScript grammar is very similar to the C family. There are a few points worth mentioning:

Control structures

JavaScript has a similar set of control structures to other languages in the C family. Conditional statements are supported by if and else; you can chain them together:

Inheritance and the prototype chain

JavaScript objects can be thought of as collections of key-value pairs. As such, they are similar to:

rest parameter syntax

Along with objects, functions are the core component in understanding JavaScript. The most basic function declaration looks like this:

Asynchronous programming

JavaScript is single-threaded by nature. There's no paralleling; only concurrency. Asynchronous programming is powered by an event loop, which allows a set of tasks to be queued and polled for completion.

core language specification

Throughout this page, we've constantly mentioned that certain features are language-level while others are runtime-level.

IEEE 754 64-bit double-precision floating point value

JavaScript has two built-in numeric types: Number and BigInt.

Immediately invoked function expression (IIFE)

JavaScript lets you create anonymous functions — that is, functions without names. In practice, anonymous functions are typically used as arguments to other functions, immediately assigned to a variable that can be used