Skip to content

Commit 1ef12f2

Browse files
authored
Remove a lot of mentions of JavaScript versions (mdn#19448)
* Remove a lot of mentions of JavaScript versions * improvements * Address reviews
1 parent 44222cf commit 1ef12f2

File tree

83 files changed

+183
-358
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+183
-358
lines changed

files/en-us/glossary/tree_shaking/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ tags:
1212
---
1313
**Tree shaking** is a term commonly used within a JavaScript context to describe the removal of dead code.
1414

15-
It relies on the [import](/en-US/docs/Web/JavaScript/Reference/Statements/import) and [export](/en-US/docs/Web/JavaScript/Reference/Statements/export) statements in ES2015 to detect if code modules are exported and imported for use between JavaScript files.
15+
It relies on the [import](/en-US/docs/Web/JavaScript/Reference/Statements/import) and [export](/en-US/docs/Web/JavaScript/Reference/Statements/export) statements to detect if code modules are exported and imported for use between JavaScript files.
1616

1717
In modern JavaScript applications, we use module bundlers (e.g., [webpack](https://webpack.js.org/) or [Rollup](https://github.com/rollup/rollup)) to automatically remove dead code when bundling multiple JavaScript files into single files. This is important for preparing code that is production ready, for example with clean structures and minimal file size.
1818

files/en-us/learn/server-side/express_nodejs/development_environment/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ The _Nodejs_ package manager _NPM_ should also have been installed, and can be t
113113

114114
As a slightly more exciting test let's create a very basic "pure node" server that prints out "Hello World" in the browser when you visit the correct URL in your browser:
115115

116-
1. Copy the following text into a file named **hellonode.js**. This uses pure _Node_ features (nothing from Express) and some ES6 syntax:
116+
1. Copy the following text into a file named **hellonode.js**. This uses pure Node features (nothing from Express):
117117

118118
```js
119119
//Load HTTP module

files/en-us/learn/tools_and_testing/client-side_javascript_frameworks/react_resources/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ If you'd like to try this API for yourself, Smashing Magazine has written an [in
8686

8787
## Class components
8888

89-
Although this tutorial doesn't mention them, it is possible to build React components using ES6 classes – these are called class components. Until the arrival of hooks, ES6 classes were the only way to bring state into components or manage rendering side effects. They're still the only way to handle certain other, more edge-case features, and they're very common in legacy React projects. The official React docs are a great place to start learning about them.
89+
Although this tutorial doesn't mention them, it is possible to build React components using classes – these are called class components. Until the arrival of hooks, classes were the only way to bring state into components or manage rendering side effects. They're still the only way to handle certain other, more edge-case features, and they're very common in legacy React projects. The official React docs are a great place to start learning about them.
9090

9191
- [State and Lifecycle in the React Docs](https://reactjs.org/docs/state-and-lifecycle.html)
9292
- [Intro To React in the React Docs](https://reactjs.org/tutorial/tutorial.html)

files/en-us/mozilla/add-ons/webextensions/background_scripts/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ In your extension, you include a background script using the [`"background"`](/
6060

6161
You can specify multiple background scripts. If you do, they run in the same context, just like scripts loaded into a web page.
6262

63-
Instead of specifying background scripts, you can specify a background page. This has the added advantage of support for ES6 modules:
63+
Instead of specifying background scripts, you can specify a background page. This has the added advantage of support for ES modules:
6464

6565
**manifest.json**
6666

files/en-us/web/api/canvas_api/tutorial/pixel_manipulation_with_canvas/index.md

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,6 @@ const xCoord = 50;
4040
const yCoord = 100;
4141
const canvasWidth = 1024;
4242

43-
function getColorIndicesForCoord(x, y, width) {
44-
const red = y * (width * 4) + x * 4;
45-
return [red, red + 1, red + 2, red + 3];
46-
}
47-
48-
const colorIndices = getColorIndicesForCoord(xCoord, yCoord, canvasWidth);
49-
50-
const redIndex = colorIndices[0];
51-
const greenIndex = colorIndices[1];
52-
const blueIndex = colorIndices[2];
53-
const alphaIndex = colorIndices[3];
54-
55-
const redForCoord = imageData.data[redIndex];
56-
const greenForCoord = imageData.data[greenIndex];
57-
const blueForCoord = imageData.data[blueIndex];
58-
const alphaForCoord = imageData.data[alphaIndex];
59-
```
60-
61-
Or, if ES2015 is appropriate:
62-
63-
```js
64-
const xCoord = 50;
65-
const yCoord = 100;
66-
const canvasWidth = 1024;
67-
6843
const getColorIndicesForCoord = (x, y, width) => {
6944
const red = y * (width * 4) + x * 4;
7045
return [red, red + 1, red + 2, red + 3];

files/en-us/web/api/htmlscriptelement/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ _Inherits properties from its parent, {{domxref("HTMLElement")}}._
5555
- {{domxref("HTMLScriptElement.fetchPriority")}}
5656
- : An optional string representing a hint given to the browser on how it should prioritize fetching of an external script relative to other external scripts. If this value is provided, it must be one of the possible permitted values: `high` to fetch at a high priority, `low` to fetch at a low priority, or `auto` to indicate no preference (which is the default).
5757
- {{domxref("HTMLScriptElement.noModule")}}
58-
- : A boolean value that if true, stops the script's execution in browsers that support [ES2015 modules](https://hacks.mozilla.org/2015/08/es6-in-depth-modules/) — used to run fallback scripts in older browsers that do _not_ support JavaScript modules.
58+
- : A boolean value that if true, stops the script's execution in browsers that support [ES modules](/en-US/docs/Web/JavaScript/Guide/Modules) — used to run fallback scripts in older browsers that do _not_ support JavaScript modules.
5959
- {{domxref("HTMLScriptElement.referrerPolicy")}}
6060
- : A string that reflects the {{htmlattrxref("referrerPolicy", "script")}} HTML attribute indicating which referrer to use when fetching the script, and fetches done by that script.
6161

files/en-us/web/api/webrtc_api/simple_rtcdatachannel_sample/index.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ Finally, there's the little box into which we'll insert the messages. This {{HTM
5454

5555
While you can just [look at the code itself on GitHub](https://github.com/mdn/samples-server/blob/master/s/webrtc-simple-datachannel/main.js), below we'll review the parts of the code that do the heavy lifting.
5656

57-
The WebRTC API makes heavy use of {{jsxref("Promise")}}s. They make it very easy to chain the steps of the connection process together; if you haven't already read up on this functionality of [ECMAScript 2015](/en-US/docs/Archive/Web/JavaScript/New_in_JavaScript/ECMAScript_2015_support_in_Mozilla), you should read up on them. Similarly, this example uses [arrow functions](/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) to simplify syntax.
58-
5957
### Starting up
6058

6159
When the script is run, we set up a {{domxref("Window/load_event", "load")}} event listener, so that once the page is fully loaded, our `startup()` function is called.

files/en-us/web/html/element/script/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ This element includes the [global attributes](/en-US/docs/Web/HTML/Global_attrib
125125
- {{htmlattrdef("integrity")}}
126126
- : This attribute contains inline metadata that a user agent can use to verify that a fetched resource has been delivered free of unexpected manipulation. See [Subresource Integrity](/en-US/docs/Web/Security/Subresource_Integrity).
127127
- {{htmlattrdef("nomodule")}}
128-
- : This Boolean attribute is set to indicate that the script should not be executed in browsers that support [ES2015 modules](https://hacks.mozilla.org/2015/08/es6-in-depth-modules/) — in effect, this can be used to serve fallback scripts to older browsers that do not support modular JavaScript code.
128+
- : This Boolean attribute is set to indicate that the script should not be executed in browsers that support [ES modules](/en-US/docs/Web/JavaScript/Guide/Modules) — in effect, this can be used to serve fallback scripts to older browsers that do not support modular JavaScript code.
129129
- {{htmlattrdef("nonce")}}
130130
- : A cryptographic nonce (number used once) to allow scripts in a [script-src Content-Security-Policy](/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide a nonce that cannot be guessed as bypassing a resource's policy is otherwise trivial.
131131
- {{htmlattrdef("referrerpolicy")}}

files/en-us/web/javascript/closures/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ console.log(getX()); // 2
367367

368368
## Creating closures in loops: A common mistake
369369

370-
Prior to the introduction of the [`let`](/en-US/docs/Web/JavaScript/Reference/Statements/let) keyword in ECMAScript 2015, a common problem with closures occurred when you created them inside a loop. To demonstrate, consider the following example code.
370+
Prior to the introduction of the [`let`](/en-US/docs/Web/JavaScript/Reference/Statements/let) keyword, a common problem with closures occurred when you created them inside a loop. To demonstrate, consider the following example code.
371371

372372
```html
373373
<p id="help">Helpful notes will appear here</p>

files/en-us/web/javascript/data_structures/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,11 @@ Additionally, arrays inherit from `Array.prototype`, which provides to them a ha
202202

203203
### Keyed collections: Maps, Sets, WeakMaps, WeakSets
204204

205-
These data structures, introduced in ECMAScript Edition 6, take object references as keys. {{jsxref("Set")}} and {{jsxref("WeakSet")}} represent a set of objects, while {{jsxref("Map")}} and {{jsxref("WeakMap")}} associate a value to an object.
205+
These data structures take object references as keys. {{jsxref("Set")}} and {{jsxref("WeakSet")}} represent a set of objects, while {{jsxref("Map")}} and {{jsxref("WeakMap")}} associate a value to an object.
206206

207207
The difference between `Map`s and `WeakMap`s is that in the former, object keys can be enumerated over. This allows garbage collection optimizations in the latter case.
208208

209-
One could implement `Map`s and `Set`s in pure ECMAScript 5. However, since objects cannot be compared (in the sense of `<` "less than", for instance), look-up performance would necessarily be linear. Native implementations of them (including `WeakMap`s) can have look-up performance that is approximately logarithmic to constant time.
209+
You could implement `Map`s and `Set`s yourself. However, since objects cannot be compared (in the sense of `<` "less than", for instance), neither does the engine expose its hash function for objects, look-up performance would necessarily be linear. Native implementations of them (including `WeakMap`s) can have look-up performance that is approximately logarithmic to constant time.
210210

211211
Usually, to bind data to a DOM node, one could set properties directly on the object, or use `data-*` attributes. This has the downside that the data is available to any script running in the same context. `Map`s and `WeakMap`s make it easy to _privately_ bind data to an object.
212212

files/en-us/web/javascript/guide/control_flow_and_error_handling/index.md

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,31 +56,19 @@ while (x < 10) {
5656

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

59-
> **Note:** JavaScript before ECMAScript2015 (6th edition)
60-
> **does not** have block scope! In older JavaScript, variables introduced
61-
> within a block are scoped to the containing function or script, and the effects of
62-
> setting them persist beyond the block itself. In other words, _block statements do
63-
> not define a scope_.
64-
>
65-
> "Standalone" blocks in JavaScript can produce completely different results from what
66-
> they would produce in C or Java. For example:
67-
>
59+
> **Note:** [`var`](/en-US/docs/Web/JavaScript/Reference/Statements/var)-declared variables are not block-scoped, but are scoped to the containing function or script, and the effects of setting them persist beyond the block itself. For example:
60+
>
6861
> ```js
6962
> var x = 1;
7063
> {
7164
> var x = 2;
7265
> }
7366
> console.log(x); // outputs 2
7467
> ```
75-
>
76-
> This outputs `2` because the `var x` statement within the block
77-
> is in the same scope as the `var x` statement before the block. (In C or
78-
> Java, the equivalent code would have output `1`.)
79-
>
80-
> **Since ECMAScript2015**, the `let` and
81-
> `const` variable declarations are block-scoped. See the
82-
> {{jsxref("Statements/let", "let")}} and {{jsxref("Statements/const", "const")}}
83-
> reference pages for more information.
68+
>
69+
> This outputs `2` because the `var x` statement within the block is in the same scope as the `var x` statement before the block. (In C or Java, the equivalent code would have output `1`.)
70+
>
71+
> This scoping effect can be mitigated by using {{jsxref("Statements/let", "let")}} or {{jsxref("Statements/const", "const")}}.
8472
8573
## Conditional statements
8674

files/en-us/web/javascript/guide/functions/index.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -572,14 +572,12 @@ See the {{jsxref("Function")}} object in the JavaScript reference for more infor
572572

573573
## Function parameters
574574

575-
Starting with ECMAScript 2015, there are two new kinds of parameters: _default parameters_ and _rest parameters_.
575+
There are two special kinds of parameter syntax: _default parameters_ and _rest parameters_.
576576

577577
### Default parameters
578578

579579
In JavaScript, parameters of functions default to `undefined`. However, in some situations it might be useful to set a different default value. This is exactly what default parameters do.
580580

581-
#### Without default parameters (pre-ECMAScript 2015)
582-
583581
In the past, the general strategy for setting defaults was to test parameter values in the body of the function and assign a value if they are `undefined`.
584582

585583
In the following example, if no value is provided for `b`, its value would be `undefined` when evaluating `a*b`, and a call to `multiply` would normally have returned `NaN`. However, this is prevented by the second line in this example:
@@ -593,8 +591,6 @@ function multiply(a, b) {
593591
multiply(5); // 5
594592
```
595593

596-
#### With default parameters (post-ECMAScript 2015)
597-
598594
With _default parameters_, a manual check in the function body is no longer necessary. You can put `1` as the default value for `b` in the function head:
599595

600596
```js
@@ -624,7 +620,7 @@ console.log(arr); // [2, 4, 6]
624620

625621
## Arrow functions
626622

627-
An [arrow function expression](/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) (previously, and now incorrectly known as **fat arrow function**) has a shorter syntax compared to function expressions and does not have its own [`this`](/en-US/docs/Web/JavaScript/Reference/Operators/this), [arguments](/en-US/docs/Web/JavaScript/Reference/Functions/arguments), [super](/en-US/docs/Web/JavaScript/Reference/Operators/super), or [new.target](/en-US/docs/Web/JavaScript/Reference/Operators/new.target). Arrow functions are always anonymous. See also this hacks.mozilla.org blog post: "[ES6 In Depth: Arrow functions](https://hacks.mozilla.org/2015/06/es6-in-depth-arrow-functions/)".
623+
An [arrow function expression](/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) (also called a _fat arrow_ to distinguish from a hypothetical `->` syntax in future JavaScript) has a shorter syntax compared to function expressions and does not have its own [`this`](/en-US/docs/Web/JavaScript/Reference/Operators/this), [`arguments`](/en-US/docs/Web/JavaScript/Reference/Functions/arguments), [`super`](/en-US/docs/Web/JavaScript/Reference/Operators/super), or [`new.target`](/en-US/docs/Web/JavaScript/Reference/Operators/new.target). Arrow functions are always anonymous.
628624

629625
Two factors influenced the introduction of arrow functions: _shorter functions_ and _non-binding_ of `this`.
630626

@@ -649,7 +645,7 @@ const a3 = a.map((s) => s.length);
649645
console.log(a3); // logs [8, 6, 7, 9]
650646
```
651647

652-
### No separate `this`
648+
### No separate this
653649

654650
Until arrow functions, every new function defined its own [`this`](/en-US/docs/Web/JavaScript/Reference/Operators/this) value (a new object in the case of a constructor, undefined in [strict mode](/en-US/docs/Web/JavaScript/Reference/Strict_mode) function calls, the base object if the function is called as an "object method", etc.). This proved to be less than ideal with an object-oriented style of programming.
655651

@@ -710,7 +706,7 @@ JavaScript has several top-level, built-in functions:
710706
- {{jsxref("Global_Objects/isFinite", "isFinite()")}}
711707
- : The global **`isFinite()`** function determines whether the passed value is a finite number. If needed, the parameter is first converted to a number.
712708
- {{jsxref("Global_Objects/isNaN", "isNaN()")}}
713-
- : The **`isNaN()`** function determines whether a value is {{jsxref("Global_Objects/NaN", "NaN")}} or not. Note: coercion inside the `isNaN` function has [interesting](/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN#description) rules; you may alternatively want to use {{jsxref("Number.isNaN()")}}, as defined in ECMAScript 2015, or you can use [`typeof`](/en-US/docs/Web/JavaScript/Reference/Operators/typeof) to determine if the value is Not-A-Number.
709+
- : The **`isNaN()`** function determines whether a value is {{jsxref("Global_Objects/NaN", "NaN")}} or not. Note: coercion inside the `isNaN` function has [interesting](/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN#description) rules; you may alternatively want to use {{jsxref("Number.isNaN()")}} to determine if the value is Not-A-Number.
714710
- {{jsxref("Global_Objects/parseFloat", "parseFloat()")}}
715711
- : The **`parseFloat()`** function parses a string argument and returns a floating point number.
716712
- {{jsxref("Global_Objects/parseInt", "parseInt()")}}

files/en-us/web/javascript/guide/grammar_and_types/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ var myvar = 'my value';
222222

223223
Because of hoisting, all `var` statements in a function should be placed as near to the top of the function as possible. This best practice increases the clarity of the code.
224224

225-
In ECMAScript 2015, `let` and `const` **are hoisted but not initialized**. Referencing the variable in the block before the variable declaration results in a {{jsxref("ReferenceError")}}, because the variable is in a "temporal dead zone" from the start of the block until the declaration is processed.
225+
`let` and `const` **are hoisted but not initialized**. Referencing the variable in the block before the variable declaration results in a {{jsxref("ReferenceError")}}, because the variable is in a "temporal dead zone" from the start of the block until the declaration is processed.
226226

227227
```js
228228
console.log(x); // ReferenceError

files/en-us/web/javascript/guide/keyed_collections/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This chapter introduces collections of data which are indexed by a key; `Map` an
1717

1818
### Map object
1919

20-
ECMAScript 2015 introduces a new data structure to map values to values. A {{jsxref("Map")}} object is a simple key/value map and can iterate its elements in insertion order.
20+
A {{jsxref("Map")}} object is a simple key/value map and can iterate its elements in insertion order.
2121

2222
The following code shows some basic operations with a `Map`. See also the {{jsxref("Map")}} reference page for more examples and the complete API. You can use a {{jsxref("Statements/for...of","for...of")}} loop to return an array of `[key, value]` for each iteration.
2323

files/en-us/web/javascript/guide/meta_programming/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ tags:
1111
---
1212
{{jsSidebar("JavaScript Guide")}}{{PreviousNext("Web/JavaScript/Guide/Iterators_and_Generators", "Web/JavaScript/Guide/Modules")}}
1313

14-
Starting with ECMAScript 2015, JavaScript gains support for the {{jsxref("Proxy")}} and {{jsxref("Reflect")}} objects allowing you to intercept and define custom behavior for fundamental language operations (e.g. property lookup, assignment, enumeration, function invocation, etc). With the help of these two objects you are able to program at the meta level of JavaScript.
14+
The {{jsxref("Proxy")}} and {{jsxref("Reflect")}} objects allow you to intercept and define custom behavior for fundamental language operations (e.g. property lookup, assignment, enumeration, function invocation, etc). With the help of these two objects you are able to program at the meta level of JavaScript.
1515

1616
## Proxies
1717

0 commit comments

Comments
 (0)