diff --git a/files/en-us/web/javascript/eventloop/index.html b/files/en-us/web/javascript/eventloop/index.html index da568c64927e402..fcbc5b64ba0f98b 100644 --- a/files/en-us/web/javascript/eventloop/index.html +++ b/files/en-us/web/javascript/eventloop/index.html @@ -13,7 +13,7 @@ ---
{{JsSidebar("Advanced")}}
-

JavaScript has a concurrency model based on an event loop, which is responsible for executing the code, collecting and processing events, and executing queued sub-tasks. This model is quite different from models in other languages like C and Java.

+

JavaScript has a concurrency model based on an event loop, which is responsible for executing the code, collecting and processing events, and executing queued sub-tasks. This model is quite different from models in other languages like C and Java.

Runtime concepts

diff --git a/files/en-us/web/javascript/guide/iterators_and_generators/index.html b/files/en-us/web/javascript/guide/iterators_and_generators/index.html index 2989bd274e7c4f2..826cbe333929ed7 100644 --- a/files/en-us/web/javascript/guide/iterators_and_generators/index.html +++ b/files/en-us/web/javascript/guide/iterators_and_generators/index.html @@ -9,9 +9,7 @@ ---
{{jsSidebar("JavaScript Guide")}} {{PreviousNext("Web/JavaScript/Guide/Using_promises", "Web/JavaScript/Guide/Meta_programming")}}
-

Processing each of the items in a collection is a very common operation. JavaScript provides a number of ways of iterating over a collection, from simple {{jsxref("Statements/for","for")}} loops to {{jsxref("Global_Objects/Array/map","map()")}} and {{jsxref("Global_Objects/Array/filter","filter()")}}.

- -

Iterators and Generators bring the concept of iteration directly into the core language and provide a mechanism for customizing the behavior of {{jsxref("Statements/for...of","for...of")}} loops.

+

Iterators and Generators bring the concept of iteration directly into the core language and provide a mechanism for customizing the behavior of {{jsxref("Statements/for...of","for...of")}} loops.

For details, see also:

diff --git a/files/en-us/web/javascript/guide/numbers_and_dates/index.html b/files/en-us/web/javascript/guide/numbers_and_dates/index.html index 3de3f2d7a524a6b..88b919249db2ed2 100644 --- a/files/en-us/web/javascript/guide/numbers_and_dates/index.html +++ b/files/en-us/web/javascript/guide/numbers_and_dates/index.html @@ -17,7 +17,7 @@ ---
{{jsSidebar("JavaScript Guide")}} {{PreviousNext("Web/JavaScript/Guide/Expressions_and_Operators", "Web/JavaScript/Guide/Text_formatting")}}
-

This chapter introduces the concepts, objects and functions used to work with and perform calculations using numbers and dates in JavaScript. This includes using numbers written in various bases including decimal, binary, and hexadecimal, as well as the use of the global {{jsxref("Math")}} object to perform a wide variety of mathematical operations on numbers.

+

This chapter introduces the concepts, objects and functions used to work with and perform calculations using numbers and dates in JavaScript. This includes using numbers written in various bases including decimal, binary, and hexadecimal, as well as the use of the global {{jsxref("Math")}} object to perform a wide variety of mathematical operations on numbers.

Numbers

diff --git a/files/en-us/web/javascript/index.html b/files/en-us/web/javascript/index.html index ad468e65d741d0a..4cc58e8d5264252 100644 --- a/files/en-us/web/javascript/index.html +++ b/files/en-us/web/javascript/index.html @@ -10,7 +10,7 @@ ---
{{JsSidebar}}
-

JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with {{Glossary("First-class Function", "first-class functions")}}. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as {{Glossary("Node.js")}}, Apache CouchDB and Adobe Acrobat. JavaScript is a {{Glossary("Prototype-based programming", "prototype-based")}}, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles. Read more about JavaScript.

+

JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with {{Glossary("First-class Function", "first-class functions")}}. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as {{Glossary("Node.js")}}, Apache CouchDB and Adobe Acrobat. JavaScript is a {{Glossary("Prototype-based programming", "prototype-based")}}, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles. Read more about JavaScript.

This section is dedicated to the JavaScript language itself, and not the parts that are specific to Web pages or other host environments. For information about {{Glossary("API","API")}} specifics to Web pages, please see Web APIs and {{Glossary("DOM")}}.

diff --git a/files/en-us/web/javascript/reference/classes/static/index.html b/files/en-us/web/javascript/reference/classes/static/index.html index 54ebde2a569b0c1..af5c5476c0c85db 100644 --- a/files/en-us/web/javascript/reference/classes/static/index.html +++ b/files/en-us/web/javascript/reference/classes/static/index.html @@ -10,12 +10,14 @@ ---
{{jsSidebar("Classes")}}
-

The static keyword defines a +

The static keyword defines a static method or property for a class. Neither static methods nor static properties can be called on instances of the class. Instead, they're called on the class - itself. Static methods are often utility functions, such as functions to create - or clone objects, whereas static properties are useful for caches, fixed-configuration, - or any other data you don't need to be replicated across instances.

+ itself.

+ +

Static methods are often utility functions, such as functions to create +or clone objects, whereas static properties are useful for caches, fixed-configuration, +or any other data you don't need to be replicated across instances.

{{EmbedInteractiveExample("pages/js/classes-static.html")}}
diff --git a/files/en-us/web/javascript/reference/global_objects/date/date/index.html b/files/en-us/web/javascript/reference/global_objects/date/date/index.html index 24abc86738d8748..5b6276ce1bb8aae 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/date/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/date/index.html @@ -9,9 +9,9 @@ ---
{{JSRef}}
-

Creates a JavaScript Date +

Creates a JavaScript Date instance that represents a single moment in time in a platform-independent - format. Date objects contain a Number that represents + format.Date objects contain a Number that represents milliseconds since 1 January 1970 UTC.

{{EmbedInteractiveExample("pages/js/date-constructor.html")}}
diff --git a/files/en-us/web/javascript/reference/global_objects/date/getday/index.html b/files/en-us/web/javascript/reference/global_objects/date/getday/index.html index e1028d4f7132368..a310db4abd91cde 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/getday/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/getday/index.html @@ -10,10 +10,9 @@ ---
{{JSRef}}
-

The getDay() method returns the +

The getDay() method returns the day of the week for the specified date according to local time, where 0 represents - Sunday. For the day of the month, see {{jsxref("Date.prototype.getDate()")}}. -

+ Sunday. For the day of the month, see {{jsxref("Date.prototype.getDate()")}}.

{{EmbedInteractiveExample("pages/js/date-getday.html", "shorter")}}
diff --git a/files/en-us/web/javascript/reference/global_objects/date/index.html b/files/en-us/web/javascript/reference/global_objects/date/index.html index 83572a0f62078f2..6f7e21d77601e80 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/index.html @@ -12,7 +12,7 @@ ---
{{JSRef}}
-

JavaScript Date objects represent a single moment in time in a platform-independent format. Date objects contain a Number that represents milliseconds since 1 January 1970 UTC.

+

JavaScript Date objects represent a single moment in time in a platform-independent format. Date objects contain a Number that represents milliseconds since 1 January 1970 UTC.

TC39 is working on Temporal, a new Date/Time API. Read more about it on the Igalia blog. It is not yet ready for production use!

diff --git a/files/en-us/web/javascript/reference/global_objects/map/index.html b/files/en-us/web/javascript/reference/global_objects/map/index.html index 12a2de2fc6c3848..a2bda6e2b2bb8c7 100644 --- a/files/en-us/web/javascript/reference/global_objects/map/index.html +++ b/files/en-us/web/javascript/reference/global_objects/map/index.html @@ -10,8 +10,8 @@ ---
{{JSRef}}
-

The Map object holds key-value - pairs and remembers the original insertion order of the keys. Any value (both +

The Map object holds key-value + pairs and remembers the original insertion order of the keys. Any value (both objects and {{glossary("Primitive", "primitive values")}}) may be used as either a key or a value.

diff --git a/files/en-us/web/javascript/reference/global_objects/math/abs/index.html b/files/en-us/web/javascript/reference/global_objects/math/abs/index.html index 11c36c27956c43a..26c332a4794051b 100644 --- a/files/en-us/web/javascript/reference/global_objects/math/abs/index.html +++ b/files/en-us/web/javascript/reference/global_objects/math/abs/index.html @@ -9,75 +9,9 @@ ---
{{JSRef}}
-

The Math.abs() function returns - the absolute value of a number, that is

- -

- - - - - Math.abs - ( - x - ) - - - = - - | - x - | - - = - - { - - - - x - - - if - - x - > - 0 - - - - - 0 - - - if - - x - = - 0 - - - - - - - x - - - if - - x - < - 0 - - - - - - {\mathtt{\operatorname{Math.abs}(z)}} = {|z|} = - \begin{cases} x & \text{if} \quad x \geq 0 \\ x & \text{if} \quad x < 0 - \end{cases} - -

+

The Math.abs() function returns + the absolute value of a number. That is, it returns x if x + is positive or zero, and the negation of x if x is negative.

{{EmbedInteractiveExample("pages/js/math-abs.html")}}
diff --git a/files/en-us/web/javascript/reference/global_objects/math/cos/index.html b/files/en-us/web/javascript/reference/global_objects/math/cos/index.html index 3b3d3babfa1db64..7431cdf17cafd4f 100644 --- a/files/en-us/web/javascript/reference/global_objects/math/cos/index.html +++ b/files/en-us/web/javascript/reference/global_objects/math/cos/index.html @@ -13,35 +13,9 @@ ---
{{JSRef}}
-

The Math.cos() static function +

The Math.cos() static function returns the {{interwiki("wikipedia", "cosine")}} of the specified angle, which must be - specified in {{interwiki("wikipedia", "radians")}}. This value is - - - - - length - - - - adjacent - - - - - - length - - - - hypotenuse - - - - - - .

+ specified in {{interwiki("wikipedia", "radians")}}.

{{EmbedInteractiveExample("pages/js/math-cos.html")}}
diff --git a/files/en-us/web/javascript/reference/global_objects/number/isfinite/index.html b/files/en-us/web/javascript/reference/global_objects/number/isfinite/index.html index bc78a736b7a05da..9c70970cf805ebb 100644 --- a/files/en-us/web/javascript/reference/global_objects/number/isfinite/index.html +++ b/files/en-us/web/javascript/reference/global_objects/number/isfinite/index.html @@ -9,11 +9,10 @@ ---
{{JSRef}}
-

The Number.isFinite() method +

The Number.isFinite() method determines whether the passed value is a finite number — that is, it checks that the type of a given value is {{jsxref("Number")}}, and the number is neither positive - {{jsxref("Infinity")}}, negative Infinity, nor {{jsxref("NaN")}}. -

+ {{jsxref("Infinity")}}, negative Infinity, nor {{jsxref("NaN")}}.

{{EmbedInteractiveExample("pages/js/number-isfinite.html")}}
diff --git a/files/en-us/web/javascript/reference/global_objects/rangeerror/index.html b/files/en-us/web/javascript/reference/global_objects/rangeerror/index.html index 3cfc026b1cfe8b5..4dd77dced44a98d 100644 --- a/files/en-us/web/javascript/reference/global_objects/rangeerror/index.html +++ b/files/en-us/web/javascript/reference/global_objects/rangeerror/index.html @@ -9,7 +9,7 @@ ---
{{JSRef}}
-

The RangeError object indicates an error when a value is not in the set or range of allowed values.

+

The RangeError object indicates an error when a value is not in the set or range of allowed values.

Description

diff --git a/files/en-us/web/javascript/reference/global_objects/rangeerror/rangeerror/index.html b/files/en-us/web/javascript/reference/global_objects/rangeerror/rangeerror/index.html index 0b498ab0b320b7f..221fffa43166bf0 100644 --- a/files/en-us/web/javascript/reference/global_objects/rangeerror/rangeerror/index.html +++ b/files/en-us/web/javascript/reference/global_objects/rangeerror/rangeerror/index.html @@ -8,9 +8,8 @@ ---
{{JSRef}}
-

The RangeError() constructor - creates an error when a value is not in the set or range of allowed values. -

+

The RangeError() constructor creates an error + when a value is not in the set or range of allowed values.

Syntax

diff --git a/files/en-us/web/javascript/reference/global_objects/reflect/preventextensions/index.html b/files/en-us/web/javascript/reference/global_objects/reflect/preventextensions/index.html index 2ec000026b079b8..78c57062d3e208f 100644 --- a/files/en-us/web/javascript/reference/global_objects/reflect/preventextensions/index.html +++ b/files/en-us/web/javascript/reference/global_objects/reflect/preventextensions/index.html @@ -10,10 +10,10 @@ ---
{{JSRef}}
-

The static +

The static Reflect.preventExtensions() method prevents new properties from ever being added to an object (i.e., prevents future extensions to the - object). It is similar to {{jsxref("Object.preventExtensions()")}}, but with + object). It is similar to {{jsxref("Object.preventExtensions()")}}, but with some differences.

{{EmbedInteractiveExample("pages/js/reflect-preventextensions.html")}}
diff --git a/files/en-us/web/javascript/reference/global_objects/reflect/setprototypeof/index.html b/files/en-us/web/javascript/reference/global_objects/reflect/setprototypeof/index.html index a3018d458b47d69..a0829b350b3f7c4 100644 --- a/files/en-us/web/javascript/reference/global_objects/reflect/setprototypeof/index.html +++ b/files/en-us/web/javascript/reference/global_objects/reflect/setprototypeof/index.html @@ -10,12 +10,12 @@ ---
{{JSRef}}
-

The static +

The static Reflect.setPrototypeOf() method is the same method as {{jsxref("Object.setPrototypeOf()")}}, except for its return type. It sets the prototype (i.e., the internal [[Prototype]] property) of a specified object to another object or to {{jsxref("null")}}, and returns true if - the operation was successful, or false otherwise.

+ the operation was successful, or false otherwise.

{{EmbedInteractiveExample("pages/js/reflect-setprototypeof.html")}}
diff --git a/files/en-us/web/javascript/reference/global_objects/string/padstart/index.html b/files/en-us/web/javascript/reference/global_objects/string/padstart/index.html index 99ec75879127496..38915d7825362d8 100644 --- a/files/en-us/web/javascript/reference/global_objects/string/padstart/index.html +++ b/files/en-us/web/javascript/reference/global_objects/string/padstart/index.html @@ -12,9 +12,9 @@ ---
{{JSRef}}
-

The padStart() method pads the +

The padStart() method pads the current string with another string (multiple times, if needed) until the resulting - string reaches the given length. The padding is applied from the start of the + string reaches the given length. The padding is applied from the start of the current string.

{{EmbedInteractiveExample("pages/js/string-padstart.html")}}
diff --git a/files/en-us/web/javascript/reference/global_objects/string/raw/index.html b/files/en-us/web/javascript/reference/global_objects/string/raw/index.html index 9fa9e12a53324a1..77231f76c0924ed 100644 --- a/files/en-us/web/javascript/reference/global_objects/string/raw/index.html +++ b/files/en-us/web/javascript/reference/global_objects/string/raw/index.html @@ -10,15 +10,14 @@ ---
{{JSRef}}
-

The static String.raw() method +

The static String.raw() method is a tag function of template literals. This is similar to the r prefix in Python, or the @ prefix in C# for string literals. (But it is not identical; see explanations in this issue.) It's used to get the raw string form of template literals, that is, substitutions (e.g. - ${foo}) are processed, but escapes (e.g. \n) are not. -

+ ${foo}) are processed, but escapes (e.g. \n) are not.

{{EmbedInteractiveExample("pages/js/string-raw.html")}}
diff --git a/files/en-us/web/javascript/reference/global_objects/string/replace/index.html b/files/en-us/web/javascript/reference/global_objects/string/replace/index.html index 335be331f6895ca..28af805109541b5 100644 --- a/files/en-us/web/javascript/reference/global_objects/string/replace/index.html +++ b/files/en-us/web/javascript/reference/global_objects/string/replace/index.html @@ -12,9 +12,9 @@ ---
{{JSRef}}
-

The replace() method returns a +

The replace() method returns a new string with some or all matches of a pattern replaced by a - replacement. The pattern can be a string or a + replacement. The pattern can be a string or a {{jsxref("RegExp")}}, and the replacement can be a string or a function to be called for each match. If pattern is a string, only the first occurrence will be replaced.

diff --git a/files/en-us/web/javascript/reference/global_objects/string/replaceall/index.html b/files/en-us/web/javascript/reference/global_objects/string/replaceall/index.html index 7b7388074b49aaa..1859b7f6c48c96d 100644 --- a/files/en-us/web/javascript/reference/global_objects/string/replaceall/index.html +++ b/files/en-us/web/javascript/reference/global_objects/string/replaceall/index.html @@ -11,9 +11,9 @@ ---
{{JSRef}}
-

The replaceAll() method returns +

The replaceAll() method returns a new string with all matches of a pattern replaced by a - replacement. The pattern can be a string or a + replacement. The pattern can be a string or a {{jsxref("RegExp")}}, and the replacement can be a string or a function to be called for each match.

diff --git a/files/en-us/web/javascript/reference/operators/conditional_operator/index.html b/files/en-us/web/javascript/reference/operators/conditional_operator/index.html index 20869e6d8282c6a..10cc1bada266983 100644 --- a/files/en-us/web/javascript/reference/operators/conditional_operator/index.html +++ b/files/en-us/web/javascript/reference/operators/conditional_operator/index.html @@ -15,11 +15,11 @@ ---
{{jsSidebar("Operators")}}
-

The conditional (ternary) operator is the +

The conditional (ternary) operator is the only JavaScript operator that takes three operands: a condition followed by a question mark (?), then an expression to execute if the condition is {{Glossary("truthy")}} followed by a colon (:), and finally the - expression to execute if the condition is {{Glossary("falsy")}}. This + expression to execute if the condition is {{Glossary("falsy")}}. This operator is frequently used as a shortcut for the if statement.

diff --git a/files/en-us/web/javascript/reference/operators/optional_chaining/index.html b/files/en-us/web/javascript/reference/operators/optional_chaining/index.html index b2cfa2e94556067..82820a4e3dc703a 100644 --- a/files/en-us/web/javascript/reference/operators/optional_chaining/index.html +++ b/files/en-us/web/javascript/reference/operators/optional_chaining/index.html @@ -12,13 +12,14 @@
{{JSSidebar("Operators")}}

The optional chaining operator (?.) - permits reading the value of a property located deep within a chain of connected objects - without having to expressly validate that each reference in the chain is valid. The ?. operator functions similarly to the + enables you to read the value of a property located deep within a chain of connected objects + without having to check that each reference in the chain is valid.

+ +

The ?. operator is like the . chaining operator, except that instead of causing an error if a reference is nullish ({{JSxRef("null")}} or {{JSxRef("undefined")}}), the expression short-circuits with a return value of - undefined. When used with function calls, it returns + undefined. When used with function calls, it returns undefined if the given function does not exist.

This results in shorter and simpler expressions when accessing chained properties when diff --git a/files/en-us/web/javascript/reference/statements/async_function/index.html b/files/en-us/web/javascript/reference/statements/async_function/index.html index 4737441d246e9bc..28428895c61b5b7 100644 --- a/files/en-us/web/javascript/reference/statements/async_function/index.html +++ b/files/en-us/web/javascript/reference/statements/async_function/index.html @@ -10,8 +10,7 @@ ---

{{jsSidebar("Statements")}}
-

An async function is a function declared with the async keyword, and the await keyword is permitted within them. The async and await keywords enable asynchronous, promise-based behavior to be written in a cleaner style, avoiding the need to explicitly configure promise chains. -

+

An async function is a function declared with the async keyword, and the await keyword is permitted within them. The async and await keywords enable asynchronous, promise-based behavior to be written in a cleaner style, avoiding the need to explicitly configure promise chains.

Async functions may also be defined {{jsxref("Operators/async_function", "as expressions", "", 1)}}.

diff --git a/files/en-us/web/javascript/reference/statements/import/index.html b/files/en-us/web/javascript/reference/statements/import/index.html index 14b2fdb3afcae23..7a4099a6d2a368f 100644 --- a/files/en-us/web/javascript/reference/statements/import/index.html +++ b/files/en-us/web/javascript/reference/statements/import/index.html @@ -13,10 +13,11 @@ ---
{{jsSidebar("Statements")}}
-

The static import statement is +

The static import statement is used to import read only live bindings which are exported by - another module. Imported modules are in {{JSxRef("Strict_mode","strict mode")}} + another module.

+

Imported modules are in {{JSxRef("Strict_mode","strict mode")}} whether you declare them as such or not. The import statement cannot be used in embedded scripts unless such script has a type="module". Bindings imported are called live bindings because they are updated by the module that exported diff --git a/files/en-us/web/javascript/typed_arrays/index.html b/files/en-us/web/javascript/typed_arrays/index.html index 11bd8333febef57..4007eec172cf5ef 100644 --- a/files/en-us/web/javascript/typed_arrays/index.html +++ b/files/en-us/web/javascript/typed_arrays/index.html @@ -7,9 +7,9 @@ ---

{{JsSidebar("Advanced")}}
-

JavaScript typed arrays are array-like objects that provide a mechanism for reading and writing raw binary data in memory buffers. As you may already know, {{jsxref("Array")}} objects grow and shrink dynamically and can have any JavaScript value. JavaScript engines perform optimizations so that these arrays are fast.

+

JavaScript typed arrays are array-like objects that provide a mechanism for reading and writing raw binary data in memory buffers.

-

However, as web applications become more and more powerful, adding features such as audio and video manipulation, access to raw data using WebSockets, and so forth, it has become clear that there are times when it would be helpful for JavaScript code to be able to quickly and easily manipulate raw binary data. This is where typed arrays come in. Each entry in a JavaScript typed array is a raw binary value in one of a number of supported formats, from 8-bit integers to 64-bit floating-point numbers.

+

{{jsxref("Array")}} objects grow and shrink dynamically and can have any JavaScript value. JavaScript engines perform optimizations so that these arrays are fast. However, as web applications become more and more powerful, adding features such as audio and video manipulation, access to raw data using WebSockets, and so forth, it has become clear that there are times when it would be helpful for JavaScript code to be able to quickly and easily manipulate raw binary data. This is where typed arrays come in. Each entry in a JavaScript typed array is a raw binary value in one of a number of supported formats, from 8-bit integers to 64-bit floating-point numbers.

However, typed arrays are not to be confused with normal arrays, as calling {{jsxref("Array.isArray()")}} on a typed array returns false. Moreover, not all methods available for normal arrays are supported by typed arrays (e.g. push and pop).