From 6740fa6e28055bb85fe038e9327b8b4b377a876d Mon Sep 17 00:00:00 2001 From: Will <> Date: Mon, 26 Apr 2021 16:31:33 -0700 Subject: [PATCH 1/5] In JS docs, use Note: consistently at the start of notes --- .../a_re-introduction_to_javascript/index.html | 14 +++++++------- files/en-us/web/javascript/closures/index.html | 2 +- .../web/javascript/data_structures/index.html | 4 ++-- .../control_flow_and_error_handling/index.html | 6 +++--- .../guide/details_of_the_object_model/index.html | 2 +- .../web/javascript/guide/functions/index.html | 2 +- .../javascript/guide/grammar_and_types/index.html | 14 +++++++------- .../javascript/guide/keyed_collections/index.html | 3 +-- .../regular_expressions/assertions/index.html | 4 ++-- .../character_classes/index.html | 2 +- .../regular_expressions/cheatsheet/index.html | 10 +++++----- .../groups_and_ranges/index.html | 4 ++-- .../inheritance_and_the_prototype_chain/index.html | 2 +- .../classes/public_class_fields/index.html | 4 ++-- .../reference/errors/too_much_recursion/index.html | 2 +- .../functions/arguments/length/index.html | 2 +- .../reference/functions/arrow_functions/index.html | 2 +- .../javascript/reference/functions/get/index.html | 2 +- .../global_objects/array/every/index.html | 2 +- .../global_objects/array/findindex/index.html | 2 +- .../global_objects/array/foreach/index.html | 11 ++++------- .../reference/global_objects/array/from/index.html | 4 ++-- .../global_objects/array/reduce/index.html | 2 +- .../reference/global_objects/array/some/index.html | 2 +- .../reference/global_objects/array/sort/index.html | 4 ++-- .../global_objects/array/values/index.html | 2 +- .../reference/global_objects/date/index.html | 2 +- .../reference/global_objects/date/parse/index.html | 6 +++--- .../reference/global_objects/error/index.html | 2 +- .../global_objects/function/call/index.html | 6 +++--- .../global_objects/function/name/index.html | 2 +- .../intl/collator/collator/index.html | 8 ++++---- .../intl/datetimeformat/datetimeformat/index.html | 11 +++-------- .../reference/global_objects/map/index.html | 2 +- .../global_objects/math/random/index.html | 4 ++-- .../global_objects/object/constructor/index.html | 2 +- .../global_objects/object/isprototypeof/index.html | 2 +- .../global_objects/object/valueof/index.html | 2 +- .../reference/global_objects/promise/index.html | 2 +- .../global_objects/promise/then/index.html | 2 +- .../global_objects/proxy/proxy/set/index.html | 5 +---- .../reflect/defineproperty/index.html | 2 +- .../reference/global_objects/regexp/index.html | 2 +- .../sharedarraybuffer/planned_changes/index.html | 2 +- .../sharedarraybuffer/sharedarraybuffer/index.html | 2 +- .../reference/global_objects/string/big/index.html | 2 +- .../global_objects/string/fontcolor/index.html | 2 +- .../global_objects/string/fontsize/index.html | 2 +- .../reference/global_objects/string/index.html | 4 ++-- .../global_objects/string/replaceall/index.html | 2 +- .../global_objects/typedarray/values/index.html | 4 ++-- .../reference/global_objects/undefined/index.html | 2 +- .../operators/destructuring_assignment/index.html | 4 ++-- .../javascript/reference/operators/new/index.html | 6 +++--- .../javascript/reference/operators/this/index.html | 9 +++++---- .../reference/statements/async_function/index.html | 9 +++------ .../reference/statements/for-await...of/index.html | 4 ++-- .../javascript/reference/statements/let/index.html | 4 ++-- .../reference/statements/return/index.html | 6 ++++-- .../reference/statements/with/index.html | 6 ++++-- .../javascript/reference/strict_mode/index.html | 3 +-- 61 files changed, 117 insertions(+), 128 deletions(-) diff --git a/files/en-us/web/javascript/a_re-introduction_to_javascript/index.html b/files/en-us/web/javascript/a_re-introduction_to_javascript/index.html index a546d97cba5e635..c74932899884801 100644 --- a/files/en-us/web/javascript/a_re-introduction_to_javascript/index.html +++ b/files/en-us/web/javascript/a_re-introduction_to_javascript/index.html @@ -18,7 +18,7 @@

Several months later, Microsoft released JScript with Internet Explorer 3. It was a mostly-compatible JavaScript work-alike. Several months after that, Netscape submitted JavaScript to Ecma International, a European standards organization, which resulted in the first edition of the ECMAScript standard that year. The standard received a significant update as ECMAScript edition 3 in 1999, and it has stayed pretty much stable ever since. The fourth edition was abandoned, due to political differences concerning language complexity. Many parts of the fourth edition formed the basis for ECMAScript edition 5, published in December of 2009, and for the 6th major edition of the standard, published in June of 2015.

-

Because it is more familiar, we will refer to ECMAScript as "JavaScript" from this point on.

+

Note: Because it is more familiar, we will refer to ECMAScript as "JavaScript" from this point on.

Unlike most programming languages, the JavaScript language has no concept of input or output. It is designed to run as a scripting language in a host environment, and it is up to the host environment to provide mechanisms for communicating with the outside world. The most common host environment is the browser, but JavaScript interpreters can also be found in a huge list of other places, including Adobe Acrobat, Adobe Photoshop, SVG images, Yahoo's Widget engine, server-side environments such as Node.js, NoSQL databases like the open source Apache CouchDB, embedded computers, complete desktop environments like GNOME (one of the most popular GUIs for GNU/Linux operating systems), and others.

@@ -155,7 +155,7 @@

Numbers

isFinite(NaN); // false -
The {{jsxref("Global_Objects/parseInt", "parseInt()")}} and {{jsxref("Global_Objects/parseFloat", "parseFloat()")}} functions parse a string until they reach a character that isn't valid for the specified number format, then return the number parsed up to that point. However the "+" operator converts the string to NaN if there is an invalid character contained within it. Just try parsing the string "10.2abc" with each method by yourself in the console and you'll understand the differences better.
+
Note: The {{jsxref("Global_Objects/parseInt", "parseInt()")}} and {{jsxref("Global_Objects/parseFloat", "parseFloat()")}} functions parse a string until they reach a character that isn't valid for the specified number format, then return the number parsed up to that point. However the "+" operator converts the string to NaN if there is an invalid character contained within it. Just try parsing the string "10.2abc" with each method by yourself in the console and you'll understand the differences better.

Strings

@@ -466,13 +466,13 @@

Objects

-

Starting in ECMAScript 5, reserved words may be used as object property names "in the buff". This means that they don't need to be "clothed" in quotes when defining object literals. See the ES5 Spec.

+

Note: Starting in ECMAScript 5, reserved words may be used as object property names "in the buff". This means that they don't need to be "clothed" in quotes when defining object literals. See the ES5 Spec.

For more on objects and prototypes see Object.prototype. For an explanation of object prototypes and the object prototype chains see Inheritance and the prototype chain.

-

Starting in ECMAScript 2015, object keys can be defined by the variable using bracket notation upon being created. {[phoneType]: 12345} is possible instead of just var userPhone = {}; userPhone[phoneType] = 12345.

+

Note: Starting in ECMAScript 2015, object keys can be defined by the variable using bracket notation upon being created. {[phoneType]: 12345} is possible instead of just var userPhone = {}; userPhone[phoneType] = 12345.

Arrays

@@ -658,7 +658,7 @@

Functions

avg(2, 3, 4, 5); // 3.5 -
In the above code, the variable args holds all the values that were passed into the function.
+
Note: In the above code, the variable args holds all the values that were passed into the function.

It is important to note that wherever the rest parameter operator is placed in a function declaration it will store all arguments after its declaration, but not before. i.e. function avg(firstValue, ...args) will store the first value passed into the function in the firstValue variable and the remaining arguments in args. That's another useful language feature but it does lead us to a new problem. The avg() function takes a comma-separated list of arguments — but what if you want to find the average of an array? You could just rewrite the function as follows:
@@ -681,7 +681,7 @@

Functions

The second argument to apply() is the array to use as arguments; the first will be discussed later on. This emphasizes the fact that functions are objects too.

-

You can achieve the same result using the spread operator in the function call.

+

Note: You can achieve the same result using the spread operator in the function call.

For instance: avg(...numbers)

@@ -757,7 +757,7 @@

Recursive functions

Custom objects

-
For a more detailed discussion of object-oriented programming in JavaScript, see Introduction to Object-Oriented JavaScript.
+
Note: For a more detailed discussion of object-oriented programming in JavaScript, see Introduction to Object-Oriented JavaScript.

In classic Object Oriented Programming, objects are collections of data and methods that operate on that data. JavaScript is a prototype-based language that contains no class statement, as you'd find in C++ or Java (this is sometimes confusing for programmers accustomed to languages with a class statement). Instead, JavaScript uses functions as classes. Let's consider a person object with first and last name fields. There are two ways in which the name might be displayed: as "first last" or as "last, first". Using the functions and objects that we've discussed previously, we could display the data like this:

diff --git a/files/en-us/web/javascript/closures/index.html b/files/en-us/web/javascript/closures/index.html index 9da4b52045d683f..46bfe1636bba41e 100644 --- a/files/en-us/web/javascript/closures/index.html +++ b/files/en-us/web/javascript/closures/index.html @@ -208,7 +208,7 @@

Emulating private methods with

Notice how the two counters maintain their independence from one another. Each closure references a different version of the privateCounter variable through its own closure. Each time one of the counters is called, its lexical environment changes by changing the value of this variable. Changes to the variable value in one closure don't affect the value in the other closure.

-

Using closures in this way provides benefits that are normally associated with object-oriented programming. In particular, data hiding and encapsulation.

+

Note: Using closures in this way provides benefits that are normally associated with object-oriented programming. In particular, data hiding and encapsulation.

Closure Scope Chain

diff --git a/files/en-us/web/javascript/data_structures/index.html b/files/en-us/web/javascript/data_structures/index.html index 3a8e2fc8d658748..20ac3b5040ac6c9 100644 --- a/files/en-us/web/javascript/data_structures/index.html +++ b/files/en-us/web/javascript/data_structures/index.html @@ -78,7 +78,7 @@

Number type

To check for the largest available value or smallest available value within {{jsxref("Infinity", "±Infinity")}}, you can use the constants {{jsxref("Number.MAX_VALUE")}} or {{jsxref("Number.MIN_VALUE")}}.

-

Starting with ECMAScript 2015, you are also able to check if a number is in the double-precision floating-point number range using {{jsxref("Number.isSafeInteger()")}} as well as {{jsxref("Number.MAX_SAFE_INTEGER")}} and {{jsxref("Number.MIN_SAFE_INTEGER")}}.

+

Note: Starting with ECMAScript 2015, you are also able to check if a number is in the double-precision floating-point number range using {{jsxref("Number.isSafeInteger()")}} as well as {{jsxref("Number.MAX_SAFE_INTEGER")}} and {{jsxref("Number.MIN_SAFE_INTEGER")}}.

Beyond this range, integers in JavaScript are not safe anymore and will be a double-precision floating point approximation of the value.

@@ -96,7 +96,7 @@

Number type

Although a number often represents only its value, JavaScript provides {{jsxref("Operators", "binary (bitwise) operators")}}.

-

Caution: Although bitwise operators can be used to represent several Boolean values within a single number using bit masking, this is usually considered a bad practice. JavaScript offers other means to represent a set of Booleans (like an array of Booleans, or an object with Boolean values assigned to named properties). Bit masking also tends to make the code more difficult to read, understand, and maintain.

+

Note: Although bitwise operators can be used to represent several Boolean values within a single number using bit masking, this is usually considered a bad practice. JavaScript offers other means to represent a set of Booleans (like an array of Booleans, or an object with Boolean values assigned to named properties). Bit masking also tends to make the code more difficult to read, understand, and maintain.

It may be necessary to use such techniques in very constrained environments, like when trying to cope with the limitations of local storage, or in extreme cases (such as when each bit over the network counts). This technique should only be considered when it is the last measure that can be taken to optimize size.

diff --git a/files/en-us/web/javascript/guide/control_flow_and_error_handling/index.html b/files/en-us/web/javascript/guide/control_flow_and_error_handling/index.html index c96acca8b536b2b..893cd1629a4abcf 100644 --- a/files/en-us/web/javascript/guide/control_flow_and_error_handling/index.html +++ b/files/en-us/web/javascript/guide/control_flow_and_error_handling/index.html @@ -55,7 +55,7 @@

Example

Here, { x++; } is the block statement.

-

Important: JavaScript before ECMAScript2015 (6th edition) +

Note: JavaScript before ECMAScript2015 (6th edition) does not have block scope!  In older JavaScript, variables introduced within a block are scoped to the containing function or script, and the effects of setting them persist beyond the block itself. In other words, block statements do @@ -181,7 +181,7 @@

Falsy values

conditional statement.

-

Caution: Do not confuse the primitive boolean values +

Note: Do not confuse the primitive boolean values true and false with the true and false values of the {{jsxref("Boolean")}} object!

@@ -437,7 +437,7 @@

The catch block

-

Best practice: When logging errors to the console inside +

Note: When logging errors to the console inside a catch block, using console.error() rather than console.log() is advised for debugging. It formats the message as an error, and adds it to the list of error messages generated by the page. 

diff --git a/files/en-us/web/javascript/guide/details_of_the_object_model/index.html b/files/en-us/web/javascript/guide/details_of_the_object_model/index.html index 7c9ff561ce35799..7257a4598069f6a 100644 --- a/files/en-us/web/javascript/guide/details_of_the_object_model/index.html +++ b/files/en-us/web/javascript/guide/details_of_the_object_model/index.html @@ -32,7 +32,7 @@

Defining a class

JavaScript follows a similar model, but does not have a class definition separate from the constructor. Instead, you define a constructor function to create objects with a particular initial set of properties and values. Any JavaScript function can be used as a constructor. You use the new operator with a constructor function to create a new object.

-

Note that ECMAScript 2015 introduces a class declaration:

+

Note: ECMAScript 2015 introduces a class declaration:

JavaScript classes, introduced in ECMAScript 2015, are primarily syntactical sugar over JavaScript's existing prototype-based inheritance. The class syntax does not introduce a new object-oriented inheritance model to JavaScript.

diff --git a/files/en-us/web/javascript/guide/functions/index.html b/files/en-us/web/javascript/guide/functions/index.html index 8a3d0ee783ad573..ba0d8a15421eaa5 100644 --- a/files/en-us/web/javascript/guide/functions/index.html +++ b/files/en-us/web/javascript/guide/functions/index.html @@ -470,7 +470,7 @@

Closures

-

Caution: There are a number of pitfalls to watch out for when using closures!

+

Note: There are a number of pitfalls to watch out for when using closures!

If an enclosed function defines a variable with the same name as a variable in the outer scope, then there is no way to refer to the variable in the outer scope again.  (The inner scope variable "overrides" the outer one, until the program exits the inner scope.)

diff --git a/files/en-us/web/javascript/guide/grammar_and_types/index.html b/files/en-us/web/javascript/guide/grammar_and_types/index.html index 086ae5dd7a910b0..c1b9d1c0b99a428 100644 --- a/files/en-us/web/javascript/guide/grammar_and_types/index.html +++ b/files/en-us/web/javascript/guide/grammar_and_types/index.html @@ -25,7 +25,7 @@

Basics

A semicolon is not necessary after a statement if it is written on its own line. But if more than one statement on a line is desired, then they must be separated by semicolons.

-

ECMAScript also has rules for automatic insertion of semicolons (ASI) to end statements. (For more information, see the detailed reference about JavaScript's lexical grammar.)

+

Note: ECMAScript also has rules for automatic insertion of semicolons (ASI) to end statements. (For more information, see the detailed reference about JavaScript's lexical grammar.)

It is considered best practice, however, to always write a semicolon after a statement, even when it is not strictly needed. This practice reduces the chances of bugs getting into the code.

@@ -48,7 +48,7 @@

Comments

Comments behave like whitespace, and are discarded during script execution.

-

Note: You might also see a third type of comment syntax at the start of some JavaScript files, which looks something like this: #!/usr/bin/env node.

+

Note: You might also see a third type of comment syntax at the start of some JavaScript files, which looks something like this: #!/usr/bin/env node.

This is called hashbang comment syntax, and is a special comment used to specify the path to a particular JavaScript engine that should execute the script. See Hashbang comments for more details.

@@ -347,7 +347,7 @@

Converting strings to numbers

parseInt only returns whole numbers, so its use is diminished for decimals.

-

Additionally, a best practice for parseInt is to always include the radix parameter. The radix parameter is used to specify which numerical system is to be used.

+

Note: Additionally, a best practice for parseInt is to always include the radix parameter. The radix parameter is used to specify which numerical system is to be used.

parseInt('101', 2) // 5
@@ -382,7 +382,7 @@

Array literals

-

Note : An array literal is a type of object initializer. See Using Object Initializers.

+

Note: An array literal is a type of object initializer. See Using Object Initializers.

If an array is created using a literal in a top-level script, JavaScript interprets the array each time it evaluates the expression containing the array literal. In addition, a literal used in a function is created each time the function is called.

@@ -411,7 +411,7 @@

Extra commas in array literals

In the following example, the length of the array is three. There is no myList[3]. All other commas in the list indicate a new element.

-

Note : Trailing commas can create errors in older browser versions and it is a best practice to remove them.

+

Note: Trailing commas can create errors in older browser versions and it is a best practice to remove them.

let myList = ['home', , 'school', ];
@@ -436,7 +436,7 @@ 

Boolean literals

The Boolean type has two literal values: true and false.

-

Be careful: Do not confuse the primitive Boolean values true and false with the true and false values of the {{jsxref("Boolean")}} object.

+

Note: Do not confuse the primitive Boolean values true and false with the true and false values of the {{jsxref("Boolean")}} object.

The Boolean object is a wrapper around the primitive Boolean data type. See {{jsxref("Boolean")}} for more information.

@@ -495,7 +495,7 @@

Object literals

An object literal is a list of zero or more pairs of property names and associated values of an object, enclosed in curly braces ({}).

-

Do not use an object literal at the beginning of a statement! This will lead to an error (or not behave as you expect), because the { will be interpreted as the beginning of a block.

+

Note: Do not use an object literal at the beginning of a statement! This will lead to an error (or not behave as you expect), because the { will be interpreted as the beginning of a block.

The following is an example of an object literal. The first element of the car object defines a property, myCar, and assigns to it a new string, "Saturn"; the second element, the getCar property, is immediately assigned the result of invoking the function (carTypes("Honda")); the third element, the special property, uses an existing variable (sales).

diff --git a/files/en-us/web/javascript/guide/keyed_collections/index.html b/files/en-us/web/javascript/guide/keyed_collections/index.html index 5515c7c70c46470..56ec6fc5754d6d7 100644 --- a/files/en-us/web/javascript/guide/keyed_collections/index.html +++ b/files/en-us/web/javascript/guide/keyed_collections/index.html @@ -114,8 +114,7 @@

Converting between Array and Set

You can create an {{jsxref("Array")}} from a Set using {{jsxref("Array.from")}} or the spread syntax. Also, the Set constructor accepts an Array to convert in the other direction.

-

Note

-

Remember that Set objects store unique values—so any duplicate elements from an Array are deleted when converting!

+

Note: Set objects store unique values—so any duplicate elements from an Array are deleted when converting!

Array.from(mySet);
diff --git a/files/en-us/web/javascript/guide/regular_expressions/assertions/index.html b/files/en-us/web/javascript/guide/regular_expressions/assertions/index.html
index 7500eec8f9f8237..287d53628916632 100644
--- a/files/en-us/web/javascript/guide/regular_expressions/assertions/index.html
+++ b/files/en-us/web/javascript/guide/regular_expressions/assertions/index.html
@@ -34,7 +34,7 @@ 

Boundary-type assertions

Matches the beginning of input. If the multiline flag is set to true, also matches immediately after a line break character. For example, /^A/ does not match the "A" in "an A", but does match the first "A" in "An A".

-

This character has a different meaning when it appears at the start of a group.

+

Note: This character has a different meaning when it appears at the start of a group.

@@ -73,7 +73,7 @@

Boundary-type assertions

Other assertions

-

Note: The ? character may also be used as a quantifier.

+

Note: The ? character may also be used as a quantifier.

diff --git a/files/en-us/web/javascript/guide/regular_expressions/character_classes/index.html b/files/en-us/web/javascript/guide/regular_expressions/character_classes/index.html index 34ac11364f8617d..4657809a29182c2 100644 --- a/files/en-us/web/javascript/guide/regular_expressions/character_classes/index.html +++ b/files/en-us/web/javascript/guide/regular_expressions/character_classes/index.html @@ -140,7 +140,7 @@

Types

-

To match this character literally, escape it with itself. In other words to search for \ use /\\/.

+

Note: To match this character literally, escape it with itself. In other words to search for \ use /\\/.

diff --git a/files/en-us/web/javascript/guide/regular_expressions/cheatsheet/index.html b/files/en-us/web/javascript/guide/regular_expressions/cheatsheet/index.html index 3c832d63f73e254..08d66fb3f809625 100644 --- a/files/en-us/web/javascript/guide/regular_expressions/cheatsheet/index.html +++ b/files/en-us/web/javascript/guide/regular_expressions/cheatsheet/index.html @@ -134,7 +134,7 @@

unicode flag, these will cause an invalid identity escape error. This is done to ensure backward compatibility with existing code that uses new escape sequences like \p or \k.

-

To match this character literally, escape it with itself. In other words to search for \ use /\\/.

+

Note: To match this character literally, escape it with itself. In other words to search for \ use /\\/.

@@ -160,7 +160,7 @@

Boundary-type assertions

Matches the beginning of input. If the multiline flag is set to true, also matches immediately after a line break character. For example, /^A/ does not match the "A" in "an A", but does match the first "A" in "An A".

-

This character has a different meaning when it appears at the start of a group.

+

Note: This character has a different meaning when it appears at the start of a group.

@@ -199,7 +199,7 @@

Boundary-type assertions

Other assertions

-

Note: The ? character may also be used as a quantifier.

+

Note: The ? character may also be used as a quantifier.

@@ -277,7 +277,7 @@

@@ -307,7 +307,7 @@

-

\k is used literally here to indicate the beginning of a back reference to a Named capture group.

+

Note: \k is used literally here to indicate the beginning of a back reference to a Named capture group.

diff --git a/files/en-us/web/javascript/guide/regular_expressions/groups_and_ranges/index.html b/files/en-us/web/javascript/guide/regular_expressions/groups_and_ranges/index.html index 67d73ebf6553576..058187cdf220f17 100644 --- a/files/en-us/web/javascript/guide/regular_expressions/groups_and_ranges/index.html +++ b/files/en-us/web/javascript/guide/regular_expressions/groups_and_ranges/index.html @@ -55,7 +55,7 @@

Types

A negated or complemented character class. That is, it matches anything that is not enclosed in the brackets. You can specify a range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character class as a normal character. For example, [^abc] is the same as [^a-c]. They initially match "o" in "bacon" and "h" in "chop".

@@ -85,7 +85,7 @@

Types

For example, /(?<title>\w+), yes \k<title>/ matches "Sir, yes Sir" in "Do you copy? Sir, yes Sir!".

-

\k is used literally here to indicate the beginning of a back reference to a Named capture group.

+

Note: \k is used literally here to indicate the beginning of a back reference to a Named capture group.

diff --git a/files/en-us/web/javascript/inheritance_and_the_prototype_chain/index.html b/files/en-us/web/javascript/inheritance_and_the_prototype_chain/index.html index bd01d7f751116d6..0ceeba433bf90a4 100644 --- a/files/en-us/web/javascript/inheritance_and_the_prototype_chain/index.html +++ b/files/en-us/web/javascript/inheritance_and_the_prototype_chain/index.html @@ -25,7 +25,7 @@

Inheriting properties

JavaScript objects are dynamic "bags" of properties (referred to as own properties). JavaScript objects have a link to a prototype object. When trying to access a property of an object, the property will not only be sought on the object but on the prototype of the object, the prototype of the prototype, and so on until either a property with a matching name is found or the end of the prototype chain is reached.

-

Following the ECMAScript standard, the notation someObject.[[Prototype]] is used to designate the prototype of someObject. Since ECMAScript 2015, the [[Prototype]] is accessed using the accessors {{jsxref("Object.getPrototypeOf()")}} and {{jsxref("Object.setPrototypeOf()")}}. This is equivalent to the JavaScript property __proto__ which is non-standard but de-facto implemented by many browsers.

+

Note: Following the ECMAScript standard, the notation someObject.[[Prototype]] is used to designate the prototype of someObject. Since ECMAScript 2015, the [[Prototype]] is accessed using the accessors {{jsxref("Object.getPrototypeOf()")}} and {{jsxref("Object.setPrototypeOf()")}}. This is equivalent to the JavaScript property __proto__ which is non-standard but de-facto implemented by many browsers.

It should not be confused with the func.prototype property of functions, which instead specifies the [[Prototype]] to be assigned to all instances of objects created by the given function when used as a constructor. The Object.prototype property represents the {{jsxref("Object")}} prototype object.

diff --git a/files/en-us/web/javascript/reference/classes/public_class_fields/index.html b/files/en-us/web/javascript/reference/classes/public_class_fields/index.html index 6754e10ea3e729a..e22323581e0748d 100644 --- a/files/en-us/web/javascript/reference/classes/public_class_fields/index.html +++ b/files/en-us/web/javascript/reference/classes/public_class_fields/index.html @@ -9,9 +9,9 @@
{{JsSidebar("Classes")}}
-

This page describes experimental features.

+

Note: This page describes experimental features.

-

Both Public and private field declarations are an Both public and private field declarations are an experimental feature (stage 3) proposed at TC39, the JavaScript standards committee.

diff --git a/files/en-us/web/javascript/reference/errors/too_much_recursion/index.html b/files/en-us/web/javascript/reference/errors/too_much_recursion/index.html index f72ac1113ea217e..5fd44eed3a9af60 100644 --- a/files/en-us/web/javascript/reference/errors/too_much_recursion/index.html +++ b/files/en-us/web/javascript/reference/errors/too_much_recursion/index.html @@ -93,7 +93,7 @@

Class error: too much recursion

-

In this example when the setter is triggered, it is told to do the same thing +

Note: In this example when the setter is triggered, it is told to do the same thing again: to set the same property that it is meant to handle. This causes the function to call itself, again and again, making it infinitely recursive.

diff --git a/files/en-us/web/javascript/reference/functions/arguments/length/index.html b/files/en-us/web/javascript/reference/functions/arguments/length/index.html index 5a69fdbfe852b9e..89ce95427863664 100644 --- a/files/en-us/web/javascript/reference/functions/arguments/length/index.html +++ b/files/en-us/web/javascript/reference/functions/arguments/length/index.html @@ -31,7 +31,7 @@

Using arguments.length

-

Note the difference between {{jsxref("Function.length")}} and arguments.length

+

Note: Note the difference between {{jsxref("Function.length")}} and arguments.length

Specifications

diff --git a/files/en-us/web/javascript/reference/functions/arrow_functions/index.html b/files/en-us/web/javascript/reference/functions/arrow_functions/index.html index d789adee9a47216..186b0ce985e6234 100644 --- a/files/en-us/web/javascript/reference/functions/arrow_functions/index.html +++ b/files/en-us/web/javascript/reference/functions/arrow_functions/index.html @@ -70,7 +70,7 @@

Comparing traditiona a => a + 100;
-

As shown above, the { brackets } and ( parentheses ) and "return" are optional, but +

Note: As shown above, the { brackets } and ( parentheses ) and "return" are optional, but may be required.

diff --git a/files/en-us/web/javascript/reference/functions/get/index.html b/files/en-us/web/javascript/reference/functions/get/index.html index 88bc712bb2962ab..24d1f8b0b788b2c 100644 --- a/files/en-us/web/javascript/reference/functions/get/index.html +++ b/files/en-us/web/javascript/reference/functions/get/index.html @@ -129,7 +129,7 @@

Smart / self-overwriting / lazy get
-

This means that you shouldn’t write a lazy getter for a property whose value you +

Note: This means that you shouldn’t write a lazy getter for a property whose value you expect to change, because if the getter is lazy then it will not recalculate the value.

diff --git a/files/en-us/web/javascript/reference/global_objects/array/every/index.html b/files/en-us/web/javascript/reference/global_objects/array/every/index.html index fa54e049f326e7e..84b30dbdf1528f7 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/every/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/every/index.html @@ -71,7 +71,7 @@

Description

for all elements, every returns true.

-

Caution: Calling this method on an empty array will return +

Note: Calling this method on an empty array will return true for any condition!

diff --git a/files/en-us/web/javascript/reference/global_objects/array/findindex/index.html b/files/en-us/web/javascript/reference/global_objects/array/findindex/index.html index 7d019598abb9282..e94648bec98b577 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/findindex/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/findindex/index.html @@ -84,7 +84,7 @@

Description

-1.

-

Edge case alert: Unlike other array methods such as +

Note: Unlike other array methods such as {{jsxref("Array.some()")}}, callback is run even for indexes with unassigned values.

diff --git a/files/en-us/web/javascript/reference/global_objects/array/foreach/index.html b/files/en-us/web/javascript/reference/global_objects/array/foreach/index.html index 26f3efb9e5e7f9e..f1e9819fa77376e 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/foreach/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/foreach/index.html @@ -104,7 +104,7 @@

Description

callback may do so)

-

There is no way to stop or break a forEach() loop other than by throwing +

Note: There is no way to stop or break a forEach() loop other than by throwing an exception. If you need such behavior, the forEach() method is the wrong tool.

@@ -130,12 +130,9 @@

Description

-

forEach expects a synchronous function -

- forEach does not wait for promises. Kindly make sure you are aware of the - implications while using promises(or async functions) as forEach callback. - -
Example Code
+

Note: forEach expects a synchronous function.

+

forEach does not wait for promises. Make sure you are aware of the + implications while using promises (or async functions) as forEach callback.

let ratings = [5, 4, 5];
 let sum = 0;
diff --git a/files/en-us/web/javascript/reference/global_objects/array/from/index.html b/files/en-us/web/javascript/reference/global_objects/array/from/index.html
index 5d06b2159273467..01c8162200d61f4 100644
--- a/files/en-us/web/javascript/reference/global_objects/array/from/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/array/from/index.html
@@ -73,7 +73,7 @@ 

Description

as Array.from(obj).map(mapFn, thisArg),
except that it does not create an intermediate array.

-
This is especially important for certain array subclasses, like Note: This is especially important for certain array subclasses, like typed arrays, since the intermediate array would necessarily have values truncated to fit into the appropriate type.
@@ -196,7 +196,7 @@

Polyfill

natively support it.

-

Polyfill Notes: This algorithm is exactly as specified in +

Note: This algorithm is exactly as specified in ECMA-262 6th Edition (assuming Object and TypeError have their original values and that callback.call() evaluates to the original value of diff --git a/files/en-us/web/javascript/reference/global_objects/array/reduce/index.html b/files/en-us/web/javascript/reference/global_objects/array/reduce/index.html index bb1d88f499271f1..db07b012a50a6ad 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/reduce/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/reduce/index.html @@ -348,7 +348,7 @@

Polyfill

-

Caution: If you need to support truly obsolete JavaScript engines +

Note: If you need to support truly obsolete JavaScript engines that do not support {{domxref("Object.defineProperty()")}}, it is best not to polyfill Array.prototype methods at all, as you cannot make them non-enumerable.

diff --git a/files/en-us/web/javascript/reference/global_objects/array/some/index.html b/files/en-us/web/javascript/reference/global_objects/array/some/index.html index c9bfb73af29c40c..f7a6ac2630c1f12 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/some/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/some/index.html @@ -97,7 +97,7 @@

Description

visits that element's index. Elements that are deleted are not visited.

-

Caution: Calling this method on an empty array returns +

Note: Calling this method on an empty array returns false for any condition!

diff --git a/files/en-us/web/javascript/reference/global_objects/array/sort/index.html b/files/en-us/web/javascript/reference/global_objects/array/sort/index.html index e7a6b5494e2e668..ee1d9833f3825e5 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/sort/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/sort/index.html @@ -67,7 +67,7 @@

Description

-

Note : In UTF-16, Unicode characters above \uFFFF are +

Note: In UTF-16, Unicode characters above \uFFFF are encoded as two surrogate code units, of the range \uD800-\uDFFF. The value of each code unit is taken separately into account for the comparison. Thus the character formed by the surrogate @@ -271,7 +271,7 @@

Sort stability

After sorting this array by grade in ascending order:

-
students.sort((firstItem, secondItem) => firstItem.grade - secondItem.grade);  
+
students.sort((firstItem, secondItem) => firstItem.grade - secondItem.grade);
 

The students variable will then have the following value:

diff --git a/files/en-us/web/javascript/reference/global_objects/array/values/index.html b/files/en-us/web/javascript/reference/global_objects/array/values/index.html index 4ba72ed168592f4..22891c3bf013bb9 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/values/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/values/index.html @@ -91,7 +91,7 @@

Iteration using .next()

-

if the values in the array changed the array iterator object values change too.

+

Note: If the values in the array changed the array iterator object values change too.

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 6f7e21d77601e80..eb0d1f386a29399 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 @@ -15,7 +15,7 @@

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!

+

Note: 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!

Description

diff --git a/files/en-us/web/javascript/reference/global_objects/date/parse/index.html b/files/en-us/web/javascript/reference/global_objects/date/parse/index.html index 699da510ebbc365..df153bf7d52b223 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/parse/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/parse/index.html @@ -85,7 +85,7 @@

Fall-back to implementation-specific date formats

-

This section contains implementation-specific behavior that can be inconsistent +

Note: This section contains implementation-specific behavior that can be inconsistent across implementations.

@@ -139,7 +139,7 @@

Fall-back to

Differences in assumed time zone

-

This section contains implementation-specific behavior that can be inconsistent +

Note: This section contains implementation-specific behavior that can be inconsistent across implementations.

@@ -174,7 +174,7 @@

Using Date.parse()

Non-standard date strings

-

This section contains implementation-specific behavior that can be inconsistent +

Note: This section contains implementation-specific behavior that can be inconsistent across implementations.

diff --git a/files/en-us/web/javascript/reference/global_objects/error/index.html b/files/en-us/web/javascript/reference/global_objects/error/index.html index 33a5311f2e4eda1..1cbb06f08f9530c 100644 --- a/files/en-us/web/javascript/reference/global_objects/error/index.html +++ b/files/en-us/web/javascript/reference/global_objects/error/index.html @@ -122,7 +122,7 @@

ES6 Custom Error Class

-

Some browsers include the CustomError constructor in the stack trace when using ES2015 classes.

+

Note: Some browsers include the CustomError constructor in the stack trace when using ES2015 classes.

class CustomError extends Error {
diff --git a/files/en-us/web/javascript/reference/global_objects/function/call/index.html b/files/en-us/web/javascript/reference/global_objects/function/call/index.html
index e1b1261c99c4a51..5e269a0879cbc28 100644
--- a/files/en-us/web/javascript/reference/global_objects/function/call/index.html
+++ b/files/en-us/web/javascript/reference/global_objects/function/call/index.html
@@ -28,7 +28,7 @@ 

Parameters

-

Caution: In certain cases, thisArg may +

Note: In certain cases, thisArg may not be the actual value seen by the method.

If the method is a function in {{jsxref("Strict_mode", "non-strict mode", "", @@ -110,7 +110,7 @@

Using call to i

-

Passing the object as this value is not strictly necessary, but is done +

Note: Passing the object as this value is not strictly necessary, but is done for explanatory purpose.

@@ -165,7 +165,7 @@

-

Caution: In strict mode, the value of this will be +

Note: In strict mode, the value of this will be undefined. See below.

diff --git a/files/en-us/web/javascript/reference/global_objects/function/name/index.html b/files/en-us/web/javascript/reference/global_objects/function/name/index.html index e9872b2c3b59c65..a86ccdaf2428834 100644 --- a/files/en-us/web/javascript/reference/global_objects/function/name/index.html +++ b/files/en-us/web/javascript/reference/global_objects/function/name/index.html @@ -16,7 +16,7 @@
{{js_property_attributes(0,0,1)}}
-

Note that in non-standard, pre-ES2015 implementations the configurable attribute was false as well.

+

Note: In non-standard, pre-ES2015 implementations the configurable attribute was false as well.

JavaScript compressors and minifiers

diff --git a/files/en-us/web/javascript/reference/global_objects/intl/collator/collator/index.html b/files/en-us/web/javascript/reference/global_objects/intl/collator/collator/index.html index 54a1832f20162d6..20b6544abe0af19 100644 --- a/files/en-us/web/javascript/reference/global_objects/intl/collator/collator/index.html +++ b/files/en-us/web/javascript/reference/global_objects/intl/collator/collator/index.html @@ -37,7 +37,7 @@

Parameters

The following Unicode extension keys are allowed:

-

These keys can usually also be set with options (as listed +

Note: These keys can usually also be set with options (as listed below). When both are set, the options property takes precedence.

@@ -111,7 +111,7 @@

Parameters

"10". Possible values are true and false; the default is false.
-

This option can also be set through the kn Unicode +

Note: This option can also be set through the kn Unicode extension key; if both are provided, this options property takes precedence.

@@ -125,7 +125,7 @@

Parameters

key; if both are provided, the options property takes precedence.
-

This option can also be set through the kf Unicode +

Note: This option can also be set through the kf Unicode extension key; if both are provided, this options property takes precedence.

@@ -138,7 +138,7 @@

Parameters

"reformed", "searchjl", "stroke", "trad", "unihan".
-

This option can also be set through the co Unicode +

Note: This option can also be set through the co Unicode extension key; if both are provided, this options property takes precedence.

diff --git a/files/en-us/web/javascript/reference/global_objects/intl/datetimeformat/datetimeformat/index.html b/files/en-us/web/javascript/reference/global_objects/intl/datetimeformat/datetimeformat/index.html index fc04465ee72a660..d91d06dbc9ebfae 100644 --- a/files/en-us/web/javascript/reference/global_objects/intl/datetimeformat/datetimeformat/index.html +++ b/files/en-us/web/javascript/reference/global_objects/intl/datetimeformat/datetimeformat/index.html @@ -74,7 +74,7 @@

Parameters

-

dateStyle can be used with timeStyle, but +

Note: dateStyle can be used with timeStyle, but not with other options (e.g. weekday, hour, month, etc.).

@@ -91,7 +91,7 @@

Parameters

-

timeStyle can be used with dateStyle, but +

Note: timeStyle can be used with dateStyle, but not with other options (e.g. weekday, hour, month, etc.).

@@ -225,12 +225,7 @@

Parameters

The representation of the second. Possible values are "numeric", "2-digit".
fractionalSecondDigits
-
-
-

Added in Firefox 84, Chrome 84, etc. See - compatibility table for more information.

-
- The number of digits used to represent fractions of a second (any +
The number of digits used to represent fractions of a second (any additional digits are truncated). Possible values are:
    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 2f88f9869241c6a..be46a2581257411 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 @@ -380,7 +380,7 @@

    Cloning and merging Maps

    console.log(original === clone) // false (useful for shallow comparison)
-

Important: Keep in mind that the data itself is not cloned. +

Note: Keep in mind that the data itself is not cloned.

diff --git a/files/en-us/web/javascript/reference/global_objects/math/random/index.html b/files/en-us/web/javascript/reference/global_objects/math/random/index.html index 4751958058ebe0e..f2e0637a1182b12 100644 --- a/files/en-us/web/javascript/reference/global_objects/math/random/index.html +++ b/files/en-us/web/javascript/reference/global_objects/math/random/index.html @@ -20,7 +20,7 @@
{{EmbedInteractiveExample("pages/js/math-random.html")}}
-

Math.random() does not provide cryptographically secure random +

Note: Math.random() does not provide cryptographically secure random numbers. Do not use them for anything related to security. Use the Web Crypto API instead, and more precisely the {{domxref("Crypto.getRandomValues", "window.crypto.getRandomValues()")}} method.

@@ -79,7 +79,7 @@

Getting a random integer be
-

It might be tempting to use Math.round() to accomplish that, but doing +

Note: It might be tempting to use Math.round() to accomplish that, but doing so would cause your random numbers to follow a non-uniform distribution, which may not be acceptable for your needs.

diff --git a/files/en-us/web/javascript/reference/global_objects/object/constructor/index.html b/files/en-us/web/javascript/reference/global_objects/object/constructor/index.html index dc7e4d31efe6351..86605a40b9cd011 100644 --- a/files/en-us/web/javascript/reference/global_objects/object/constructor/index.html +++ b/files/en-us/web/javascript/reference/global_objects/object/constructor/index.html @@ -187,7 +187,7 @@

Changing the constructor of a fu
-

Summary: Manually updating or setting the constructor can lead to different and sometimes confusing consequences. To prevent this, just define the role of constructor in each specific case. In most cases, constructor is not used and reassignment of it is not necessary.

+

Note: Manually updating or setting the constructor can lead to different and sometimes confusing consequences. To prevent this, just define the role of constructor in each specific case. In most cases, constructor is not used and reassignment of it is not necessary.

Specifications

diff --git a/files/en-us/web/javascript/reference/global_objects/object/isprototypeof/index.html b/files/en-us/web/javascript/reference/global_objects/object/isprototypeof/index.html index acd540ea77df153..61c364ec98048e5 100644 --- a/files/en-us/web/javascript/reference/global_objects/object/isprototypeof/index.html +++ b/files/en-us/web/javascript/reference/global_objects/object/isprototypeof/index.html @@ -18,7 +18,7 @@
-

isPrototypeOf() differs from the {{jsxref("Operators/instanceof", +

Note: isPrototypeOf() differs from the {{jsxref("Operators/instanceof", "instanceof")}} operator. In the expression "object instanceof AFunction", the object prototype chain is checked against AFunction.prototype, not against AFunction diff --git a/files/en-us/web/javascript/reference/global_objects/object/valueof/index.html b/files/en-us/web/javascript/reference/global_objects/object/valueof/index.html index 8ad9a95ec08b366..85912261dde70b2 100644 --- a/files/en-us/web/javascript/reference/global_objects/object/valueof/index.html +++ b/files/en-us/web/javascript/reference/global_objects/object/valueof/index.html @@ -23,7 +23,7 @@

Return value

The primitive value of the specified object.

-

A Note: A (unary) plus sign can sometimes be used as a shorthand for valueOf, e.g. in +new Number(). Also see Using unary plus. diff --git a/files/en-us/web/javascript/reference/global_objects/promise/index.html b/files/en-us/web/javascript/reference/global_objects/promise/index.html index cb00b791ce52c36..b1b9d4a2ad958be 100644 --- a/files/en-us/web/javascript/reference/global_objects/promise/index.html +++ b/files/en-us/web/javascript/reference/global_objects/promise/index.html @@ -36,7 +36,7 @@

Description

-

Not to be confused with: Several other languages have mechanisms for lazy evaluation and deferring a computation, which they also call "promises", e.g. Scheme. Promises in JavaScript represent processes that are already happening, which can be chained with callback functions. If you are looking to lazily evaluate an expression, consider the arrow function with no arguments: f = () => expression to create the lazily-evaluated expression, and f() to evaluate.

+

Note: Several other languages have mechanisms for lazy evaluation and deferring a computation, which they also call "promises", e.g. Scheme. Promises in JavaScript represent processes that are already happening, which can be chained with callback functions. If you are looking to lazily evaluate an expression, consider the arrow function with no arguments: f = () => expression to create the lazily-evaluated expression, and f() to evaluate.

diff --git a/files/en-us/web/javascript/reference/global_objects/promise/then/index.html b/files/en-us/web/javascript/reference/global_objects/promise/then/index.html index 04114be2c43a11c..3ceec285fce824f 100644 --- a/files/en-us/web/javascript/reference/global_objects/promise/then/index.html +++ b/files/en-us/web/javascript/reference/global_objects/promise/then/index.html @@ -18,7 +18,7 @@
-

If one or both arguments are omitted or are provided non-functions, then +

Note: If one or both arguments are omitted or are provided non-functions, then then will be missing the handler(s), but will not generate any errors. If the Promise that then is called on adopts a state (fulfillment or rejection) for which then has diff --git a/files/en-us/web/javascript/reference/global_objects/proxy/proxy/set/index.html b/files/en-us/web/javascript/reference/global_objects/proxy/proxy/set/index.html index 28de60d9b40d868..22b29ad17bfcbb6 100644 --- a/files/en-us/web/javascript/reference/global_objects/proxy/proxy/set/index.html +++ b/files/en-us/web/javascript/reference/global_objects/proxy/proxy/set/index.html @@ -40,14 +40,11 @@

Parameters

The object to which the assignment was originally directed. This is usually the proxy itself. But a set() handler can also be called indirectly, via the prototype chain or various other ways.

- -
-

For example: Suppose a script does +

For example, suppose a script does obj.name = "jen", and obj is not a proxy, and has no own property .name, but it has a proxy on its prototype chain. That proxy's set() handler will be called, and obj will be passed as the receiver.

-
diff --git a/files/en-us/web/javascript/reference/global_objects/reflect/defineproperty/index.html b/files/en-us/web/javascript/reference/global_objects/reflect/defineproperty/index.html index bfa2bab35439295..3593cd6d994fb54 100644 --- a/files/en-us/web/javascript/reference/global_objects/reflect/defineproperty/index.html +++ b/files/en-us/web/javascript/reference/global_objects/reflect/defineproperty/index.html @@ -49,7 +49,7 @@

Description

{{jsxref("Object.defineProperty")}} which is similar.

-

One key difference: Object.defineProperty returns the +

Note: Object.defineProperty returns the object or throws a {{jsxref("TypeError")}} if the property has not been successfully defined. Reflect.defineProperty, however, returns a {{jsxref("Boolean")}} indicating whether or not the property was successfully defined.

diff --git a/files/en-us/web/javascript/reference/global_objects/regexp/index.html b/files/en-us/web/javascript/reference/global_objects/regexp/index.html index 1a72ece8d896e4d..e5d3d517ce839e2 100644 --- a/files/en-us/web/javascript/reference/global_objects/regexp/index.html +++ b/files/en-us/web/javascript/reference/global_objects/regexp/index.html @@ -210,7 +210,7 @@

Extracting sub-domain name from URL
-

Instead of using regular expressions for parsing URLs, it is usually better to use the browsers built-in URL parser by using the URL API.

+

Note: Instead of using regular expressions for parsing URLs, it is usually better to use the browsers built-in URL parser by using the URL API.

Specifications

diff --git a/files/en-us/web/javascript/reference/global_objects/sharedarraybuffer/planned_changes/index.html b/files/en-us/web/javascript/reference/global_objects/sharedarraybuffer/planned_changes/index.html index 175f00036b5c8a1..b1baa0fb39f2427 100644 --- a/files/en-us/web/javascript/reference/global_objects/sharedarraybuffer/planned_changes/index.html +++ b/files/en-us/web/javascript/reference/global_objects/sharedarraybuffer/planned_changes/index.html @@ -16,7 +16,7 @@

There is standardization work ongoing that enables developers to create SharedArrayBuffer objects again, but changes are needed in order to be use these across threads (i.e., postMessage() for SharedArrayBuffer objects throws by default). These changes provide further isolation between sites and help reduce the impact of attacks with high-resolution timers, which can be created with shared memory.

-

Starting with Firefox 79, the features described in this document are enabled by default.

+

Note: Starting with Firefox 79, the features described in this document are enabled by default.

Chrome intends to implement similar restrictions.

diff --git a/files/en-us/web/javascript/reference/global_objects/sharedarraybuffer/sharedarraybuffer/index.html b/files/en-us/web/javascript/reference/global_objects/sharedarraybuffer/sharedarraybuffer/index.html index 1b6123769d9ca6b..e9ad93cc71c3874 100644 --- a/files/en-us/web/javascript/reference/global_objects/sharedarraybuffer/sharedarraybuffer/index.html +++ b/files/en-us/web/javascript/reference/global_objects/sharedarraybuffer/sharedarraybuffer/index.html @@ -10,7 +10,7 @@
{{JSRef}}
-

Note that SharedArrayBuffer was disabled by default in all major +

Note: SharedArrayBuffer was disabled by default in all major browsers on 5 January, 2018 in response to Spectre. Chrome re-enabled it in diff --git a/files/en-us/web/javascript/reference/global_objects/string/big/index.html b/files/en-us/web/javascript/reference/global_objects/string/big/index.html index 6329ec4ceced96b..ecd83fa024d5d0e 100644 --- a/files/en-us/web/javascript/reference/global_objects/string/big/index.html +++ b/files/en-us/web/javascript/reference/global_objects/string/big/index.html @@ -16,7 +16,7 @@ element that causes a string to be displayed in a big font.

-

Usage note: The <big> element has been removed in Note: The <big> element has been removed in HTML5 and shouldn't be used anymore. Instead web developers should use CSS properties.

diff --git a/files/en-us/web/javascript/reference/global_objects/string/fontcolor/index.html b/files/en-us/web/javascript/reference/global_objects/string/fontcolor/index.html index 8ad38c86223001c..d827c269f7781a8 100644 --- a/files/en-us/web/javascript/reference/global_objects/string/fontcolor/index.html +++ b/files/en-us/web/javascript/reference/global_objects/string/fontcolor/index.html @@ -16,7 +16,7 @@ HTML element that causes a string to be displayed in the specified font color.

-

Usage note: The <font> element has been removed in Note: The <font> element has been removed in HTML5 and shouldn't be used anymore. Instead web developers should use CSS properties.

diff --git a/files/en-us/web/javascript/reference/global_objects/string/fontsize/index.html b/files/en-us/web/javascript/reference/global_objects/string/fontsize/index.html index 6ff319ee00dd1a1..087f72e5b09e42f 100644 --- a/files/en-us/web/javascript/reference/global_objects/string/fontsize/index.html +++ b/files/en-us/web/javascript/reference/global_objects/string/fontsize/index.html @@ -16,7 +16,7 @@ HTML element that causes a string to be displayed in the specified font size.

-

Usage note: The <font> element has been removed in Note: The <font> element has been removed in HTML5 and shouldn't be used anymore. Instead web developers should use CSS properties.

diff --git a/files/en-us/web/javascript/reference/global_objects/string/index.html b/files/en-us/web/javascript/reference/global_objects/string/index.html index d7f4c7a46d72ee0..d01e057d0f09372 100644 --- a/files/en-us/web/javascript/reference/global_objects/string/index.html +++ b/files/en-us/web/javascript/reference/global_objects/string/index.html @@ -413,8 +413,8 @@

Instance methods

HTML wrapper methods

-
-

Deprecated. Avoid these methods.

+
+

Warning: Deprecated. Avoid these methods.

They are of limited use, as they provide only a subset of the available HTML tags and attributes.

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 3a3cc9d866ec50c..9ed8f148d44460e 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 @@ -27,7 +27,7 @@

Syntax

-

when using a `regexp` you have to set the global ("g") flag; otherwise, it +

Note: When using a `regexp` you have to set the global ("g") flag; otherwise, it will throw a TypeError: "replaceAll must be called with a global RegExp".

diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/values/index.html b/files/en-us/web/javascript/reference/global_objects/typedarray/values/index.html index 45bd190bee8b4fc..e219876d9f8dbd5 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/values/index.html +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/values/index.html @@ -56,7 +56,7 @@

Iteration using .next()

iteraror.next().value; // undefined
-

One-use: the array iterator object is one use or temporary object

+

Note: The array iterator object is a one use or temporary object

example:

@@ -89,7 +89,7 @@

Iteration using .next()

-

if the values in the array changed the array iterator object values change too.

+

Note: If the values in the array changed the array iterator object values change too.

diff --git a/files/en-us/web/javascript/reference/global_objects/undefined/index.html b/files/en-us/web/javascript/reference/global_objects/undefined/index.html index 2a8615851c0d0da..48a2b7895f9fa4f 100644 --- a/files/en-us/web/javascript/reference/global_objects/undefined/index.html +++ b/files/en-us/web/javascript/reference/global_objects/undefined/index.html @@ -37,7 +37,7 @@

Description

a value was not {{jsxref("Statements/return", "returned")}}.

-

Be careful. While it is possible to use it as an +

Note: While you can use undefined as an {{Glossary("identifier")}} (variable name) in any scope other than the global scope (because undefined is not a {{jsxref("Reserved_Words", "reserved word", "", 1)}}), doing so is a very bad idea that will make your code difficult to maintain diff --git a/files/en-us/web/javascript/reference/operators/destructuring_assignment/index.html b/files/en-us/web/javascript/reference/operators/destructuring_assignment/index.html index dcdb1c240a31045..0ea9df1f744e3a4 100644 --- a/files/en-us/web/javascript/reference/operators/destructuring_assignment/index.html +++ b/files/en-us/web/javascript/reference/operators/destructuring_assignment/index.html @@ -218,7 +218,7 @@

Assignment without declaration

({a, b} = {a: 1, b: 2});
-

Notes: The parentheses ( ... ) around the assignment statement are required when using object literal destructuring assignment without a declaration.

+

Note: The parentheses ( ... ) around the assignment statement are required when using object literal destructuring assignment without a declaration.

{a, b} = {a: 1, b: 2} is not valid stand-alone syntax, as the {a, b} on the left-hand side is considered a block and not an object literal.

@@ -300,7 +300,7 @@

Setting a function paramete });
-

In the function signature for drawChart above, the destructured left-hand side is assigned to an empty object literal on the right-hand side: {size = 'big', coords = {x: 0, y: 0}, radius = 25} = {}. You could have also written the function without the right-hand side assignment. However, if you leave out the right-hand side assignment, the function will look for at least one argument to be supplied when invoked, whereas in its current form, you can call drawChart() without supplying any parameters. The current design is useful if you want to be able to call the function without supplying any parameters, the other can be useful when you want to ensure an object is passed to the function.

+

Note: In the function signature for drawChart above, the destructured left-hand side is assigned to an empty object literal on the right-hand side: {size = 'big', coords = {x: 0, y: 0}, radius = 25} = {}. You could have also written the function without the right-hand side assignment. However, if you leave out the right-hand side assignment, the function will look for at least one argument to be supplied when invoked, whereas in its current form, you can call drawChart() without supplying any parameters. The current design is useful if you want to be able to call the function without supplying any parameters, the other can be useful when you want to ensure an object is passed to the function.

Nested object and array destructuring

diff --git a/files/en-us/web/javascript/reference/operators/new/index.html b/files/en-us/web/javascript/reference/operators/new/index.html index ad1142bef795cb2..6b0efadb014b462 100644 --- a/files/en-us/web/javascript/reference/operators/new/index.html +++ b/files/en-us/web/javascript/reference/operators/new/index.html @@ -39,7 +39,7 @@

Description

  • Creates a blank, plain JavaScript object.
  • Adds a property to the new object (__proto__) that links to the constructor function's prototype object
    -

    Properties/objects added to the construction function prototype are therefore accessible to all instances created from the constructor function (using new).

    +

    Note: Properties/objects added to the construction function prototype are therefore accessible to all instances created from the constructor function (using new).

  • Binds the newly created object instance as the this context @@ -63,7 +63,7 @@

    Description

    -

    An object can have a property that is itself another object. See the +

    Note: An object can have a property that is itself another object. See the examples below.

    @@ -121,7 +121,7 @@

    Description

    -

    While the constructor function can be invoked like any regular function (i.e. without the new operator), +

    Note: While the constructor function can be invoked like any regular function (i.e. without the new operator), in this case a new Object is not created and the value of this is also different.

    diff --git a/files/en-us/web/javascript/reference/operators/this/index.html b/files/en-us/web/javascript/reference/operators/this/index.html index 9f9979f461756e4..e50e61002e9ea25 100644 --- a/files/en-us/web/javascript/reference/operators/this/index.html +++ b/files/en-us/web/javascript/reference/operators/this/index.html @@ -94,12 +94,13 @@

    Function context

    f2() === undefined; // true -
    In the second example, this should be +
    +

    Note: In the second example, this should be {{jsxref("undefined")}}, because f2 was called directly and not as a method or property of an object (e.g. window.f2()). This feature wasn't implemented in some browsers when they first started to support strict mode. As a result, - they incorrectly returned the window object.

    + they incorrectly returned the window object.

    To set the value of this to a particular value when calling a function, use {{jsxref("Function.prototype.call()", "call()")}}, or @@ -253,7 +254,7 @@

    Arrow functions

    console.log(foo() === globalObject); // true
    -

    Note: if this arg is passed to call, bind, or +

    Note: If this arg is passed to call, bind, or apply on invocation of an arrow function it will be ignored. You can still prepend arguments to the call, but the first argument (thisArg) should be set to null.

    @@ -418,7 +419,7 @@

    As a constructor

    keyword), its this is bound to the new object being constructed.

    -

    While the default for a constructor is to return the object referenced by +

    Note: While the default for a constructor is to return the object referenced by this, it can instead return some other object (if the return value isn't an object, then the this object is returned).

    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 28428895c61b5b7..effa2bf4e7912e5 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 @@ -48,12 +48,12 @@

    Description

    Async functions can contain zero or more {{jsxref("Operators/await", "await")}} expressions. Await expressions make promise-returning functions behave as though they're synchronous by suspending execution until the returned promise is fulfilled or rejected. The resolved value of the promise is treated as the return value of the await expression. Use of async and await enables the use of ordinary try / catch blocks around asynchronous code.

    -

    The await keyword is only valid inside async functions within regular JavaScript code. If you use it outside of an async function's body, you will get a {{jsxref("SyntaxError")}}.

    +

    Note: The await keyword is only valid inside async functions within regular JavaScript code. If you use it outside of an async function's body, you will get a {{jsxref("SyntaxError")}}.

    await can be used on its own with JavaScript modules.

    -

    The purpose of async/await is to simplify the syntax +

    Note: The purpose of async/await is to simplify the syntax necessary to consume promise-based APIs. The behavior of async/await is similar to combining generators and @@ -294,10 +294,7 @@

    Rewriting a Promise ch it's not already a promise itself (as in this example).

    -

    return await promiseValue vs. - return promiseValue

    - -

    The implicit wrapping of return values in {{jsxref("Promise.resolve")}} does not +

    Note: The implicit wrapping of return values in {{jsxref("Promise.resolve")}} does not imply that return await promiseValue is functionally equivalent to return promiseValue.

    diff --git a/files/en-us/web/javascript/reference/statements/for-await...of/index.html b/files/en-us/web/javascript/reference/statements/for-await...of/index.html index ac6b496a93267ff..e764b3c4c19b14a 100644 --- a/files/en-us/web/javascript/reference/statements/for-await...of/index.html +++ b/files/en-us/web/javascript/reference/statements/for-await...of/index.html @@ -16,7 +16,7 @@

    The for await...of statement creates a loop iterating over async iterable objects as well as on sync iterables, including: built-in {{jsxref("String")}}, {{jsxref("Array")}}, Array-like objects (e.g., {{jsxref("Functions/arguments", "arguments")}} or {{DOMxRef("NodeList")}}), {{jsxref("TypedArray")}}, {{jsxref("Map")}}, {{jsxref("Set")}}, and user-defined async/sync iterables. It invokes a custom iteration hook with statements to be executed for the value of each distinct property of the object. This statement can only be used inside an {{jsxref("Statements/async_function", "async function", "", 1)}}.

    -

    for await...of doesn't work with async iterators that are not async +

    Note: for await...of doesn't work with async iterators that are not async iterables.

    @@ -166,7 +166,7 @@

    Iterating over sync iterab
    -

    Note: be aware of yielding rejected promises from sync generator. In +

    Note: Be aware of yielding rejected promises from sync generator. In such case for await...of throws when consuming rejected promise and DOESN'T CALL finally blocks within that generator. This can be undesirable if you need to free some allocated resources with diff --git a/files/en-us/web/javascript/reference/statements/let/index.html b/files/en-us/web/javascript/reference/statements/let/index.html index 1fa51b1a37b0c98..05351a52749d9e5 100644 --- a/files/en-us/web/javascript/reference/statements/let/index.html +++ b/files/en-us/web/javascript/reference/statements/let/index.html @@ -60,7 +60,7 @@

    Description

    -

    Many issues with let variables can be avoided by declaring them at the +

    Note: Many issues with let variables can be avoided by declaring them at the top of the scope in which they are used (doing so may impact readibility).

    @@ -202,7 +202,7 @@

    Temporal dead zone (TDZ)

    {{jsxref("ReferenceError")}}.

    -

    This differs from {{jsxref("Statements/var", "var", "var_hoisting")}} variables, +

    Note: This differs from {{jsxref("Statements/var", "var", "var_hoisting")}} variables, which will return a value of undefined if they are accessed before they are declared.

    diff --git a/files/en-us/web/javascript/reference/statements/return/index.html b/files/en-us/web/javascript/reference/statements/return/index.html index e99636394bfbbe6..ee7b9a972be7594 100644 --- a/files/en-us/web/javascript/reference/statements/return/index.html +++ b/files/en-us/web/javascript/reference/statements/return/index.html @@ -68,8 +68,10 @@

    Automatic Semicolon Insertion

    The console will warn "unreachable code after return statement".

    -
    Starting with Firefox 40, a warning is shown in the console if - unreachable code is found after a return statement.
    +
    +

    Note: Starting with Firefox 40, a warning is shown in the console if + unreachable code is found after a return statement.

    +

    To avoid this problem (to prevent ASI), you could use parentheses:

    diff --git a/files/en-us/web/javascript/reference/statements/with/index.html b/files/en-us/web/javascript/reference/statements/with/index.html index a0e0116ef08d2ee..d6db47f133ad96a 100644 --- a/files/en-us/web/javascript/reference/statements/with/index.html +++ b/files/en-us/web/javascript/reference/statements/with/index.html @@ -40,11 +40,13 @@

    Description

    scope chain, then the name is bound to the property and the object containing the property. Otherwise a {{jsxref("ReferenceError")}} is thrown.

    -
    Using with is not recommended, and is forbidden in +
    +

    Note: Using with is not recommended, and is forbidden in ECMAScript 5 strict mode. The recommended alternative is to assign the object whose properties you - want to access to a temporary variable.

    + want to access to a temporary variable.

    +

    Performance pro & contra

    diff --git a/files/en-us/web/javascript/reference/strict_mode/index.html b/files/en-us/web/javascript/reference/strict_mode/index.html index f3fdacc88626546..8ad440fcc6a92d1 100644 --- a/files/en-us/web/javascript/reference/strict_mode/index.html +++ b/files/en-us/web/javascript/reference/strict_mode/index.html @@ -12,8 +12,7 @@

    Strict Mode Overview

    -

    Note

    -

    Sometimes you'll see the default, non-strict mode referred to as "Note: Sometimes you'll see the default, non-strict mode referred to as " sloppy mode". This isn't an official term, but be aware of it, just in case.

    From 15645fc38b0b4da2aa799ef951d07ecf2b40f2ed Mon Sep 17 00:00:00 2001 From: Will <> Date: Mon, 26 Apr 2021 19:24:21 -0700 Subject: [PATCH 2/5] Update some more Note: magic words --- .../guide/expressions_and_operators/index.html | 2 +- files/en-us/web/javascript/guide/modules/index.html | 12 ++++++------ .../global_objects/bigint/bigint/index.html | 2 +- .../global_objects/date/tolocalestring/index.html | 2 +- .../intl/datetimeformat/format/index.html | 2 +- .../global_objects/json/stringify/index.html | 12 ++++++------ .../reference/global_objects/math/floor/index.html | 2 +- .../object/propertyisenumerable/index.html | 2 +- .../reference/global_objects/promise/index.html | 4 ++-- .../reference/global_objects/set/values/index.html | 2 +- .../reference/global_objects/string/split/index.html | 2 +- .../global_objects/typedarray/values/index.html | 1 + .../global_objects/webassembly/compile/index.html | 2 +- .../webassembly/global/global/index.html | 2 +- .../global_objects/webassembly/global/index.html | 2 +- .../webassembly/instance/exports/index.html | 2 +- .../webassembly/instantiate/index.html | 2 +- .../webassembly/instantiatestreaming/index.html | 2 +- .../webassembly/memory/memory/index.html | 2 +- .../global_objects/webassembly/table/index.html | 2 +- .../javascript/reference/lexical_grammar/index.html | 2 +- .../web/javascript/reference/operators/index.html | 2 +- .../javascript/reference/operators/void/index.html | 2 +- 23 files changed, 34 insertions(+), 33 deletions(-) diff --git a/files/en-us/web/javascript/guide/expressions_and_operators/index.html b/files/en-us/web/javascript/guide/expressions_and_operators/index.html index 145d64589af016a..81a0950539887f9 100644 --- a/files/en-us/web/javascript/guide/expressions_and_operators/index.html +++ b/files/en-us/web/javascript/guide/expressions_and_operators/index.html @@ -349,7 +349,7 @@

    Comparison operators

  • -

    Note: (=>) is not an operator, but the notation +

    Note: => is not an operator, but the notation for Arrow functions.

    diff --git a/files/en-us/web/javascript/guide/modules/index.html b/files/en-us/web/javascript/guide/modules/index.html index 00c266a5dff5401..b02537208aca6f4 100644 --- a/files/en-us/web/javascript/guide/modules/index.html +++ b/files/en-us/web/javascript/guide/modules/index.html @@ -39,7 +39,7 @@

    Introducing an example

    These are fairly trivial, but have been kept deliberately simple to demonstrate modules clearly.

    -

    Note: If you want to download the examples and run them locally, you'll need to run them through a local web server.

    +

    Note: If you want to download the examples and run them locally, you'll need to run them through a local web server.

    Basic example structure

    @@ -53,7 +53,7 @@

    Basic example structure

    square.js
    -

    Note: All of the examples in this guide have basically the same structure; the above should start getting pretty familiar.

    +

    Note: All of the examples in this guide have basically the same structure; the above should start getting pretty familiar.

    The modules directory's two modules are described below:

    @@ -147,7 +147,7 @@

    Importing features into your script

    You can see such lines in action in main.js.

    -

    Note: In some module systems, you can omit the file extension and the leading /, ./, or ../ (e.g. 'modules/square'). This doesn't work in native JavaScript modules.

    +

    Note: In some module systems, you can omit the file extension and the leading /, ./, or ../ (e.g. 'modules/square'). This doesn't work in native JavaScript modules.

    Once you've imported the features into your script, you can use them just like they were defined inside the same file. The following is found in main.js, below the import lines:

    @@ -161,7 +161,7 @@

    Importing features into your script

    -

    Note: Although imported features are available in the file, they are read only views of the feature that was exported. You cannot change the variable that was imported, but you can still modify properties similar to const. Additionally, these features are imported as live bindings, meaning that they can change in value even if you cannot modify the binding unlike const.

    +

    Note: Although imported features are available in the file, they are read only views of the feature that was exported. You cannot change the variable that was imported, but you can still modify properties similar to const. Additionally, these features are imported as live bindings, meaning that they can change in value even if you cannot modify the binding unlike const.

    Applying the module to your HTML

    @@ -219,7 +219,7 @@

    Default exports versus named expor
    import {default as randomSquare} from './modules/square.js';
    -

    Note: The as syntax for renaming exported items is explained below in the Renaming imports and exports section.

    +

    Note: The as syntax for renaming exported items is explained below in the Renaming imports and exports section.

    Avoiding naming conflicts

    @@ -389,7 +389,7 @@

    Aggregating modules

    These grab the exports from the individual submodules and effectively make them available from the shapes.js module.

    -

    Note: The exports referenced in shapes.js basically get redirected through the file and don't really exist there, so you won't be able to write any useful related code inside the same file.

    +

    Note: The exports referenced in shapes.js basically get redirected through the file and don't really exist there, so you won't be able to write any useful related code inside the same file.

    So now in the main.js file, we can get access to all three module classes by replacing

    diff --git a/files/en-us/web/javascript/reference/global_objects/bigint/bigint/index.html b/files/en-us/web/javascript/reference/global_objects/bigint/bigint/index.html index bfebb3c049700c4..8d4c68f569341ee 100644 --- a/files/en-us/web/javascript/reference/global_objects/bigint/bigint/index.html +++ b/files/en-us/web/javascript/reference/global_objects/bigint/bigint/index.html @@ -25,7 +25,7 @@

    Parameters

    -

    Note: BigInt() is not used with the +

    Note: BigInt() is not used with the {{JSxRef("Operators/new", "new")}} operator.

    diff --git a/files/en-us/web/javascript/reference/global_objects/date/tolocalestring/index.html b/files/en-us/web/javascript/reference/global_objects/date/tolocalestring/index.html index 08badeeaa2cc5cd..7840b1bf7be80b1 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/tolocalestring/index.html +++ b/files/en-us/web/javascript/reference/global_objects/date/tolocalestring/index.html @@ -168,7 +168,7 @@

    Avoid comparing // false in IE and Edge
    -

    Note: See also this Note: See also this StackOverflow thread for more details and examples.

    diff --git a/files/en-us/web/javascript/reference/global_objects/intl/datetimeformat/format/index.html b/files/en-us/web/javascript/reference/global_objects/intl/datetimeformat/format/index.html index c166dcff2fdad97..c9fc0069a821a31 100644 --- a/files/en-us/web/javascript/reference/global_objects/intl/datetimeformat/format/index.html +++ b/files/en-us/web/javascript/reference/global_objects/intl/datetimeformat/format/index.html @@ -94,7 +94,7 @@

    Avoid comparing
    -

    Note: See also this Note: See also this StackOverflow thread for more details and examples.

    diff --git a/files/en-us/web/javascript/reference/global_objects/json/stringify/index.html b/files/en-us/web/javascript/reference/global_objects/json/stringify/index.html index c0e0adc064a64b4..e6463d5f6d45280 100644 --- a/files/en-us/web/javascript/reference/global_objects/json/stringify/index.html +++ b/files/en-us/web/javascript/reference/global_objects/json/stringify/index.html @@ -308,11 +308,11 @@

    Issue wi

    Issue with plain JSON.stringify for use as JavaScript

    -

    Historically, JSON was not a completely strict subset of JavaScript. The literal code - points U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR could appear literally in - string literals and property names in JSON text. But they could not appear literally in - similar context in JavaScript text, only using Unicode escapes as \u2028 and - \u2029. This recently changed: now both code points may appear literally in +

    Historically, JSON was not a completely strict subset of JavaScript. The literal code + points U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR could appear literally in + string literals and property names in JSON text. But they could not appear literally in + similar context in JavaScript text, only using Unicode escapes as \u2028 and + \u2029. This recently changed: now both code points may appear literally in strings in JSON and JavaScript both.

    Therefore, if compatibility with older JavaScript engines is required, it is perilous @@ -346,7 +346,7 @@

    Issue with plain
    -

    Note: Properties of non-array objects are not guaranteed to be +

    Note: Properties of non-array objects are not guaranteed to be stringified in any particular order. Do not rely on ordering of properties within the same object within the stringification.

    diff --git a/files/en-us/web/javascript/reference/global_objects/math/floor/index.html b/files/en-us/web/javascript/reference/global_objects/math/floor/index.html index a54c3d50b81d648..c4d7a7bc463a95b 100644 --- a/files/en-us/web/javascript/reference/global_objects/math/floor/index.html +++ b/files/en-us/web/javascript/reference/global_objects/math/floor/index.html @@ -38,7 +38,7 @@

    Description

    created (Math is not a constructor).

    -

    Note: Math.floor(null) returns 0, not a +

    Note: Math.floor(null) returns 0, not a {{jsxref("NaN")}}.

    diff --git a/files/en-us/web/javascript/reference/global_objects/object/propertyisenumerable/index.html b/files/en-us/web/javascript/reference/global_objects/object/propertyisenumerable/index.html index 6e8504d5c0e655a..1ed4ea6a48e618b 100644 --- a/files/en-us/web/javascript/reference/global_objects/object/propertyisenumerable/index.html +++ b/files/en-us/web/javascript/reference/global_objects/object/propertyisenumerable/index.html @@ -42,7 +42,7 @@

    Description

    property, this method returns false.

    -

    Note: Bear in mind that enumerable properties are looped over by +

    Note: Bear in mind that enumerable properties are looped over by {{jsxref("Statements/for...in", "for...in")}} loops, with the exception of {{jsxref("Global_Objects/Symbol", "Symbol")}}s.  

    diff --git a/files/en-us/web/javascript/reference/global_objects/promise/index.html b/files/en-us/web/javascript/reference/global_objects/promise/index.html index b1b9d4a2ad958be..3f76ec9dd6735bf 100644 --- a/files/en-us/web/javascript/reference/global_objects/promise/index.html +++ b/files/en-us/web/javascript/reference/global_objects/promise/index.html @@ -40,7 +40,7 @@

    Description

    -

    Note: A promise is said to be settled if it is either fulfilled or rejected, but not pending. You will also hear the term resolved used with promises — this means that the promise is settled or “locked-in” to match the state of another promise. States and fates contain more details about promise terminology.

    +

    Note: A promise is said to be settled if it is either fulfilled or rejected, but not pending. You will also hear the term resolved used with promises — this means that the promise is settled or “locked-in” to match the state of another promise. States and fates contain more details about promise terminology.

    Chained Promises

    @@ -177,7 +177,7 @@

    Incumbent settings object trackingIn the above example, the inner text of the <iframe> will be updated only if the incumbent settings object is tracked. This is because without tracking the incumbent, we may end up using the wrong environment to send the message.

    -

    Note: Currently, incumbent realm tracking is fully implemented in Firefox, and has partial implementations in Chrome and Safari.

    +

    Note: Currently, incumbent realm tracking is fully implemented in Firefox, and has partial implementations in Chrome and Safari.

    Constructor

    diff --git a/files/en-us/web/javascript/reference/global_objects/set/values/index.html b/files/en-us/web/javascript/reference/global_objects/set/values/index.html index dd82e2b76b2cb76..efb8b5f474b9e57 100644 --- a/files/en-us/web/javascript/reference/global_objects/set/values/index.html +++ b/files/en-us/web/javascript/reference/global_objects/set/values/index.html @@ -16,7 +16,7 @@

    -

    Note: The keys() method is an alias +

    Note: The keys() method is an alias for this method (for similarity with {{jsxref("Map")}} objects), hence the keys() page redirecting here. It behaves exactly the same and returns values of Set elements.

    diff --git a/files/en-us/web/javascript/reference/global_objects/string/split/index.html b/files/en-us/web/javascript/reference/global_objects/string/split/index.html index b1138bc8e5bcf4b..539919c101bd856 100644 --- a/files/en-us/web/javascript/reference/global_objects/string/split/index.html +++ b/files/en-us/web/javascript/reference/global_objects/string/split/index.html @@ -211,7 +211,7 @@

    -

    Note: \d matches the Note: \d matches the character class for digits between 0 and 9.

    diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/values/index.html b/files/en-us/web/javascript/reference/global_objects/typedarray/values/index.html index e219876d9f8dbd5..c1a7cc6b8059e16 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/values/index.html +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/values/index.html @@ -89,6 +89,7 @@

    Iteration using .next()

    +

    Note

    Note: If the values in the array changed the array iterator object values change too.

    diff --git a/files/en-us/web/javascript/reference/global_objects/webassembly/compile/index.html b/files/en-us/web/javascript/reference/global_objects/webassembly/compile/index.html index a84314c437b0089..2367869c8d7b504 100644 --- a/files/en-us/web/javascript/reference/global_objects/webassembly/compile/index.html +++ b/files/en-us/web/javascript/reference/global_objects/webassembly/compile/index.html @@ -66,7 +66,7 @@

    Using compile

    );
    -

    Note: You'll probably want to use +

    Note: You'll probably want to use {{jsxref("WebAssembly.compileStreaming()")}} in most cases, as it is more efficient than compile().

    diff --git a/files/en-us/web/javascript/reference/global_objects/webassembly/global/global/index.html b/files/en-us/web/javascript/reference/global_objects/webassembly/global/global/index.html index 3002e8c07caab1b..f7bb0fcee17e547 100644 --- a/files/en-us/web/javascript/reference/global_objects/webassembly/global/global/index.html +++ b/files/en-us/web/javascript/reference/global_objects/webassembly/global/global/index.html @@ -84,7 +84,7 @@

    Creating a new Global instance

    });
    -

    Note: You can see the example Note: You can see the example running live on GitHub; see also the source diff --git a/files/en-us/web/javascript/reference/global_objects/webassembly/global/index.html b/files/en-us/web/javascript/reference/global_objects/webassembly/global/index.html index 02b81dbf92ded25..e8edd3b1dad96ee 100644 --- a/files/en-us/web/javascript/reference/global_objects/webassembly/global/index.html +++ b/files/en-us/web/javascript/reference/global_objects/webassembly/global/index.html @@ -72,7 +72,7 @@

    Creating a new Global instance

    });

    Specifications

    diff --git a/files/en-us/web/javascript/reference/global_objects/webassembly/instance/exports/index.html b/files/en-us/web/javascript/reference/global_objects/webassembly/instance/exports/index.html index 816e362b9e53fb3..434191eeb4bcd6c 100644 --- a/files/en-us/web/javascript/reference/global_objects/webassembly/instance/exports/index.html +++ b/files/en-us/web/javascript/reference/global_objects/webassembly/instance/exports/index.html @@ -41,7 +41,7 @@

    Using exports

    .then(obj => obj.instance.exports.exported_func());
    -

    Note: You can also find this example as Note: You can also find this example as instantiate-streaming.html on GitHub (view diff --git a/files/en-us/web/javascript/reference/global_objects/webassembly/instantiate/index.html b/files/en-us/web/javascript/reference/global_objects/webassembly/instantiate/index.html index 2350184914bab5e..feaec7f0a2b253b 100644 --- a/files/en-us/web/javascript/reference/global_objects/webassembly/instantiate/index.html +++ b/files/en-us/web/javascript/reference/global_objects/webassembly/instantiate/index.html @@ -147,7 +147,7 @@

    First overload example

    );
    -

    Note: You can also find this example at Note: You can also find this example at index.html on GitHub (view it live also).

    diff --git a/files/en-us/web/javascript/reference/global_objects/webassembly/instantiatestreaming/index.html b/files/en-us/web/javascript/reference/global_objects/webassembly/instantiatestreaming/index.html index 57e0643a7700d2f..6cf009e11c83d2e 100644 --- a/files/en-us/web/javascript/reference/global_objects/webassembly/instantiatestreaming/index.html +++ b/files/en-us/web/javascript/reference/global_objects/webassembly/instantiatestreaming/index.html @@ -91,7 +91,7 @@

    Instantiating streaming

    exported function invoked.

    -

    Note: For this to work, .wasm files should be returned +

    Note: For this to work, .wasm files should be returned with an application/wasm MIME type by the server.

    diff --git a/files/en-us/web/javascript/reference/global_objects/webassembly/memory/memory/index.html b/files/en-us/web/javascript/reference/global_objects/webassembly/memory/memory/index.html index a22e25bdba63cb2..bdbbaedd535562d 100644 --- a/files/en-us/web/javascript/reference/global_objects/webassembly/memory/memory/index.html +++ b/files/en-us/web/javascript/reference/global_objects/webassembly/memory/memory/index.html @@ -46,7 +46,7 @@

    Parameters

    -

    Note: A WebAssembly page has a constant size of 65,536 bytes, i.e., +

    Note: A WebAssembly page has a constant size of 65,536 bytes, i.e., 64KiB.

    diff --git a/files/en-us/web/javascript/reference/global_objects/webassembly/table/index.html b/files/en-us/web/javascript/reference/global_objects/webassembly/table/index.html index 70f52424b0f8af0..e4c8896f6759fdf 100644 --- a/files/en-us/web/javascript/reference/global_objects/webassembly/table/index.html +++ b/files/en-us/web/javascript/reference/global_objects/webassembly/table/index.html @@ -13,7 +13,7 @@

    The WebAssembly.Table() object is a JavaScript wrapper object — an array-like structure representing a WebAssembly Table, which stores function references. A table created by JavaScript or in WebAssembly code will be accessible and mutable from both JavaScript and WebAssembly.

    -

    Note: Tables can currently only store function references, but this will likely be expanded in the future.

    +

    Note: Tables can currently only store function references, but this will likely be expanded in the future.

    Constructor

    diff --git a/files/en-us/web/javascript/reference/lexical_grammar/index.html b/files/en-us/web/javascript/reference/lexical_grammar/index.html index 02cba8252c723a3..38178487238cbce 100644 --- a/files/en-us/web/javascript/reference/lexical_grammar/index.html +++ b/files/en-us/web/javascript/reference/lexical_grammar/index.html @@ -222,7 +222,7 @@

    Hashbang comments

    -

    Note: Hashbang comments in JavaScript mimic shebangs in Unix used to run files with proper interpreter.

    +

    Note: Hashbang comments in JavaScript mimic shebangs in Unix used to run files with proper interpreter.

    diff --git a/files/en-us/web/javascript/reference/operators/index.html b/files/en-us/web/javascript/reference/operators/index.html index 638d1a378aa033f..53f0f2ded89bcb1 100644 --- a/files/en-us/web/javascript/reference/operators/index.html +++ b/files/en-us/web/javascript/reference/operators/index.html @@ -142,7 +142,7 @@

    Relational operators

    -

    Note: => is not an operator, but the notation for Arrow functions.

    +

    Note: => is not an operator, but the notation for Arrow functions.

    Equality operators

    diff --git a/files/en-us/web/javascript/reference/operators/void/index.html b/files/en-us/web/javascript/reference/operators/void/index.html index 2584853b1a5138a..1af79cf6b475b01 100644 --- a/files/en-us/web/javascript/reference/operators/void/index.html +++ b/files/en-us/web/javascript/reference/operators/void/index.html @@ -77,7 +77,7 @@

    JavaScript URIs

    -

    Note: javascript: pseudo protocol is discouraged over +

    Note: javascript: pseudo protocol is discouraged over other alternatives, such as unobtrusive event handlers.

    From 3c7b87cba1b0af9909cb674f50247dcffdd46ef7 Mon Sep 17 00:00:00 2001 From: Will <> Date: Mon, 26 Apr 2021 19:36:23 -0700 Subject: [PATCH 3/5] Wrap STRONG first children in P --- .../a_re-introduction_to_javascript/index.html | 12 +++++------- .../guide/details_of_the_object_model/index.html | 2 +- .../reference/global_objects/array/from/index.html | 4 ++-- .../global_objects/string/indexof/index.html | 4 ++-- .../reference/global_objects/unescape/index.html | 4 ++-- .../reference/global_objects/uneval/index.html | 4 ++-- .../javascript/reference/statements/for/index.html | 4 ++-- files/en-us/web/javascript/typed_arrays/index.html | 2 +- 8 files changed, 17 insertions(+), 19 deletions(-) diff --git a/files/en-us/web/javascript/a_re-introduction_to_javascript/index.html b/files/en-us/web/javascript/a_re-introduction_to_javascript/index.html index c74932899884801..94fadc8ecd94a01 100644 --- a/files/en-us/web/javascript/a_re-introduction_to_javascript/index.html +++ b/files/en-us/web/javascript/a_re-introduction_to_javascript/index.html @@ -155,7 +155,7 @@

    Numbers

    isFinite(NaN); // false -
    Note: The {{jsxref("Global_Objects/parseInt", "parseInt()")}} and {{jsxref("Global_Objects/parseFloat", "parseFloat()")}} functions parse a string until they reach a character that isn't valid for the specified number format, then return the number parsed up to that point. However the "+" operator converts the string to NaN if there is an invalid character contained within it. Just try parsing the string "10.2abc" with each method by yourself in the console and you'll understand the differences better.
    +

    Note: The {{jsxref("Global_Objects/parseInt", "parseInt()")}} and {{jsxref("Global_Objects/parseFloat", "parseFloat()")}} functions parse a string until they reach a character that isn't valid for the specified number format, then return the number parsed up to that point. However the "+" operator converts the string to NaN if there is an invalid character contained within it. Just try parsing the string "10.2abc" with each method by yourself in the console and you'll understand the differences better.

    Strings

    @@ -658,9 +658,9 @@

    Functions

    avg(2, 3, 4, 5); // 3.5 -
    Note: In the above code, the variable args holds all the values that were passed into the function.
    +

    In the above code, the variable args holds all the values that were passed into the function.

    -It is important to note that wherever the rest parameter operator is placed in a function declaration it will store all arguments after its declaration, but not before. i.e. function avg(firstValue, ...args) will store the first value passed into the function in the firstValue variable and the remaining arguments in args. That's another useful language feature but it does lead us to a new problem. The avg() function takes a comma-separated list of arguments — but what if you want to find the average of an array? You could just rewrite the function as follows:

    +It is important to note that wherever the rest parameter operator is placed in a function declaration it will store all arguments after its declaration, but not before. i.e. function avg(firstValue, ...args) will store the first value passed into the function in the firstValue variable and the remaining arguments in args. That's another useful language feature but it does lead us to a new problem. The avg() function takes a comma-separated list of arguments — but what if you want to find the average of an array? You could just rewrite the function as follows:

    function avgArray(arr) {
       var sum = 0;
    @@ -680,11 +680,9 @@ 

    Functions

    The second argument to apply() is the array to use as arguments; the first will be discussed later on. This emphasizes the fact that functions are objects too.

    -
    -

    Note: You can achieve the same result using the spread operator in the function call.

    +

    You can achieve the same result using the spread operator in the function call.

    For instance: avg(...numbers)

    -

    Anonymous functions

    @@ -757,7 +755,7 @@

    Recursive functions

    Custom objects

    -
    Note: For a more detailed discussion of object-oriented programming in JavaScript, see Introduction to Object-Oriented JavaScript.
    +

    Note: For a more detailed discussion of object-oriented programming in JavaScript, see Introduction to Object-Oriented JavaScript.

    In classic Object Oriented Programming, objects are collections of data and methods that operate on that data. JavaScript is a prototype-based language that contains no class statement, as you'd find in C++ or Java (this is sometimes confusing for programmers accustomed to languages with a class statement). Instead, JavaScript uses functions as classes. Let's consider a person object with first and last name fields. There are two ways in which the name might be displayed: as "first last" or as "last, first". Using the functions and objects that we've discussed previously, we could display the data like this:

    diff --git a/files/en-us/web/javascript/guide/details_of_the_object_model/index.html b/files/en-us/web/javascript/guide/details_of_the_object_model/index.html index 7257a4598069f6a..50447e8ce8554e1 100644 --- a/files/en-us/web/javascript/guide/details_of_the_object_model/index.html +++ b/files/en-us/web/javascript/guide/details_of_the_object_model/index.html @@ -592,7 +592,7 @@

    Determining instance relationships -
    Note: The implementation above checks the type of the object against "xml" in order to work around a quirk of how XML objects are represented in recent versions of JavaScript. See bug 634150 if you want the nitty-gritty details.
    +

    Note: The implementation above checks the type of the object against "xml" in order to work around a quirk of how XML objects are represented in recent versions of JavaScript. See bug 634150 if you want the nitty-gritty details.

    Using the instanceOf function defined above, these expressions are true:

    diff --git a/files/en-us/web/javascript/reference/global_objects/array/from/index.html b/files/en-us/web/javascript/reference/global_objects/array/from/index.html index 01c8162200d61f4..d18dd3485e9662f 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/from/index.html +++ b/files/en-us/web/javascript/reference/global_objects/array/from/index.html @@ -73,10 +73,10 @@

    Description

    as Array.from(obj).map(mapFn, thisArg),
    except that it does not create an intermediate array.

    -
    Note: This is especially important for certain array subclasses, like

    Note: This is especially important for certain array subclasses, like typed arrays, since the intermediate array would necessarily have values truncated to fit into the appropriate - type.

    + type.

    The length property of the from() method is 1.

    diff --git a/files/en-us/web/javascript/reference/global_objects/string/indexof/index.html b/files/en-us/web/javascript/reference/global_objects/string/indexof/index.html index 2365a390322447e..06fffbea19c6386 100644 --- a/files/en-us/web/javascript/reference/global_objects/string/indexof/index.html +++ b/files/en-us/web/javascript/reference/global_objects/string/indexof/index.html @@ -18,8 +18,8 @@
    {{EmbedInteractiveExample("pages/js/string-indexof.html")}}
    -
    Note: For the Array method, see - {{jsxref("Array.prototype.indexOf()")}}.
    +

    Note: For the Array method, see + {{jsxref("Array.prototype.indexOf()")}}.

    Syntax

    diff --git a/files/en-us/web/javascript/reference/global_objects/unescape/index.html b/files/en-us/web/javascript/reference/global_objects/unescape/index.html index f60cd84dd3355d4..77b9d251b102e36 100644 --- a/files/en-us/web/javascript/reference/global_objects/unescape/index.html +++ b/files/en-us/web/javascript/reference/global_objects/unescape/index.html @@ -25,8 +25,8 @@ {{jsxref("decodeURI")}} or {{jsxref("decodeURIComponent")}} are preferred over unescape.

    -
    Note: Do not use unescape to decode URIs, - use decodeURI instead.
    +

    Note: Do not use unescape to decode URIs, + use decodeURI instead.

    Syntax

    diff --git a/files/en-us/web/javascript/reference/global_objects/uneval/index.html b/files/en-us/web/javascript/reference/global_objects/uneval/index.html index cd734e9fc556769..a715d0a80759846 100644 --- a/files/en-us/web/javascript/reference/global_objects/uneval/index.html +++ b/files/en-us/web/javascript/reference/global_objects/uneval/index.html @@ -30,8 +30,8 @@

    Return value

    A string representing the source code of object.

    -
    Note: This will not return a JSON - representation of object.
    +

    Note: This will not return a JSON + representation of object.

    Description

    diff --git a/files/en-us/web/javascript/reference/statements/for/index.html b/files/en-us/web/javascript/reference/statements/for/index.html index 4b1b0989f302806..f25f3e1f46b2613 100644 --- a/files/en-us/web/javascript/reference/statements/for/index.html +++ b/files/en-us/web/javascript/reference/statements/for/index.html @@ -139,9 +139,9 @@

    Using for without a statement

    // left: 0px; // top: 153px;" -
    Note: This is one of the few cases in JavaScript where +

    Note: This is one of the few cases in JavaScript where the semicolon is mandatory. Indeed, without the semicolon the line that - follows the cycle declaration will be considered a statement.

    + follows the cycle declaration will be considered a statement.

    Specifications

    diff --git a/files/en-us/web/javascript/typed_arrays/index.html b/files/en-us/web/javascript/typed_arrays/index.html index 742f062002504bb..f36c136ef62ea2a 100644 --- a/files/en-us/web/javascript/typed_arrays/index.html +++ b/files/en-us/web/javascript/typed_arrays/index.html @@ -226,7 +226,7 @@

    Working with complex data structur

    Then you can access, for example, the amount due with amountDueView[0].

    -
    Note: The data structure alignment in a C structure is platform-dependent. Take precautions and considerations for these padding differences.
    +

    Note: The data structure alignment in a C structure is platform-dependent. Take precautions and considerations for these padding differences.

    Conversion to normal arrays

    From 973184df1675aabc9842de9f625fb77e3d41d5a2 Mon Sep 17 00:00:00 2001 From: Will <> Date: Mon, 26 Apr 2021 19:44:48 -0700 Subject: [PATCH 4/5] Convert 3 headings to STRONG elements in JS notes --- files/en-us/web/javascript/reference/classes/index.html | 6 ++---- .../reference/global_objects/typedarray/values/index.html | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/files/en-us/web/javascript/reference/classes/index.html b/files/en-us/web/javascript/reference/classes/index.html index b9e3d0cb74d588f..b9b84a5f263dc53 100644 --- a/files/en-us/web/javascript/reference/classes/index.html +++ b/files/en-us/web/javascript/reference/classes/index.html @@ -64,8 +64,7 @@

    Class expressions

    -

    Note:

    -

    Class expressions are subject to the same hoisting restrictions as described in the {{anch("Class declarations")}} section.

    +

    Note: Class expressions are subject to the same hoisting restrictions as described in the {{anch("Class declarations")}} section.

    Class body and method definitions

    @@ -257,8 +256,7 @@

    Private field declarations

    It's an error to reference private fields from outside of the class; they can only be read or written within the class body. By defining things that are not visible outside of the class, you ensure that your classes' users can't depend on internals, which may change from version to version.

    -

    Note:

    -

    Private fields can only be declared up-front in a field declaration.

    +

    Note: Private fields can only be declared up-front in a field declaration.

    Private fields cannot be created later through assigning to them, the way that normal properties can.

    diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/values/index.html b/files/en-us/web/javascript/reference/global_objects/typedarray/values/index.html index c1a7cc6b8059e16..e219876d9f8dbd5 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/values/index.html +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/values/index.html @@ -89,7 +89,6 @@

    Iteration using .next()

    -

    Note

    Note: If the values in the array changed the array iterator object values change too.

    From ecf439dcf8d6b6743aa50f681fe5fc9c705fb00e Mon Sep 17 00:00:00 2001 From: wbamberg Date: Tue, 27 Apr 2021 10:13:42 -0700 Subject: [PATCH 5/5] Revert edit to a warning --- .../reference/global_objects/typedarray/values/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/values/index.html b/files/en-us/web/javascript/reference/global_objects/typedarray/values/index.html index e219876d9f8dbd5..7644baaa64552fe 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/values/index.html +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/values/index.html @@ -56,7 +56,7 @@

    Iteration using .next()

    iteraror.next().value; // undefined
    -

    Note: The array iterator object is a one use or temporary object

    +

    One-use: the array iterator object is one use or temporary object

    example: