Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment out ellipsis in code blocks #18568

Merged
merged 1 commit into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ implementation.
sort()

// Arrow function
sort((a, b) => { /* ... */ } )
sort((a, b) => { /* */ } )

// Compare function
sort(compareFn)

// Inline compare function
sort(function compareFn(a, b) { /* ... */ })
sort(function compareFn(a, b) { /* */ })
```

### Parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ splice(start, deleteCount, item1, item2, itemN)
If `deleteCount` is `0` or negative, no elements are removed.
In this case, you should specify at least one new element (see below).

- `item1, item2, ...` {{optional_inline}}
- `item1`, …, `itemN` {{optional_inline}}
- : The elements to add to the array, beginning from `start`.

If you do not specify any elements, `splice()` will only remove elements from the array.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ beginning of an array and returns the new length of the array.
```js
unshift(element0)
unshift(element0, element1)
unshift(element0, element1, /* ... ,*/ elementN)
unshift(element0, element1, /* ,*/ elementN)
```

### Parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ if (x) {
Do not use a `Boolean` object to convert a non-boolean value to a boolean value. To perform this task, instead, use `Boolean` as a function, or a [double NOT operator](/en-US/docs/Web/JavaScript/Reference/Operators/Logical_NOT#double_not_!!):

```js
const x = Boolean(expression); // use this...
const x = !!(expression); // ...or this
const x = Boolean(expression); // use this
const x = !!(expression); // or this
const x = new Boolean(expression); // don't use this!
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ new Date().getTime();
// 1519211809934
// 1519211810362
// 1519211811670
// ...
//

// reduced time precision with `privacy.resistFingerprinting` enabled
new Date().getTime();
// 1519129853500
// 1519129858900
// 1519129864400
// ...
//
```

In Firefox, you can also enable `privacy.resistFingerprinting`, the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ Date.now()
// 1519211809934
// 1519211810362
// 1519211811670
// ...
//

// reduced time precision with `privacy.resistFingerprinting` enabled
Date.now();
// 1519129853500
// 1519129858900
// 1519129864400
// ...
//
```

In Firefox, you can also enable `privacy.resistFingerprinting`, the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function makeRSA(p, q) {
cause: { code: 'NonCoprime', values: [p, q] },
})
}
// rsa algorithm...
// rsa algorithm
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ When `Error` is used like a function, that is without {{JSxRef("Operators/new",
Therefore, a mere call to `Error` will produce the same output that constructing an `Error` object via the `new` keyword would.

```js
// this...
const x = Error('I was created using a function call!')

// ...has the same functionality as this.
// above has the same functionality as following
const y = new Error('I was constructed via the "new" keyword!')
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ try {
} else if (e instanceof RangeError) {
console.error(e.name + ': ' + e.message)
}
// ... etc
// etc.

else {
// If none of our cases matched leave the Error unhandled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The completion value of evaluating the given code. If the completion value is em

The argument of the `eval()` function is a string. It will evaluate the source string as a script body, which means both statements and expressions are allowed. It returns the completion value of the code. For expressions, it's the value the expression evaluates to. Many statements and declarations have completion values as well, but the result may be surprising (for example, the completion value of an assignment is the assigned value, but the completion value of [`let`](/en-US/docs/Web/JavaScript/Reference/Statements/let) is undefined), so it's recommended to not rely on statements' completion values.

There are two modes of `eval()` calls: _direct_ eval and _indirect_ eval. Direct eval only has one form: `eval(...)` (the invoked function's name is `eval` and its value is the global `eval` function). Everything else, including invoking it via an aliased variable, via a member access or other expression, or through the optional chaining [`?.`](/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining) operator, is indirect.
There are two modes of `eval()` calls: _direct_ eval and _indirect_ eval. Direct eval only has one form: `eval( )` (the invoked function's name is `eval` and its value is the global `eval` function). Everything else, including invoking it via an aliased variable, via a member access or other expression, or through the optional chaining [`?.`](/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining) operator, is indirect.

```js
// Indirect call using the comma operator to return eval
Expand Down Expand Up @@ -364,11 +364,11 @@ and objects' properties, and so on. Many DOM APIs are designed with this in mind
can (and should) write:

```js
// instead of setTimeout(" ... ", 1000) use:
setTimeout(function() { /* ... */ }, 1000);
// instead of setTimeout(" ", 1000) use:
setTimeout(function() { /* */ }, 1000);

// instead of elt.setAttribute("onclick", "...") use:
elt.addEventListener('click', function() { /* ... */ } , false);
// instead of elt.setAttribute("onclick", "") use:
elt.addEventListener('click', function() { /* */ } , false);
```

[Closures](/en-US/docs/Web/JavaScript/Closures) are also helpful as a way to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ The **`FinalizationRegistry`** constructor creates a {{jsxref("FinalizationRegis

```js
// Arrow callback function
new FinalizationRegistry(heldValue => { /* ... */ } )
new FinalizationRegistry(heldValue => { /* */ } )

// Callback function
new FinalizationRegistry(callbackFn)

// Inline callback function
new FinalizationRegistry(function(heldValue) { /* ... */ })
new FinalizationRegistry(function(heldValue) { /* */ })
```

### Parameters
Expand All @@ -39,7 +39,7 @@ You create the registry passing in the callback:

```js
const registry = new FinalizationRegistry(heldValue => {
// ....
//
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You create the registry passing in the callback:

```js
const registry = new FinalizationRegistry(heldValue => {
// ....
//
});
```

Expand All @@ -42,15 +42,19 @@ It's common to use the object itself as the unregister token, which is just fine

```js
registry.register(theObject, "some value", theObject);
// ...some time later, if you don't care about `theObject` anymore...
// …

// some time later, if you don't care about `theObject` anymore unregister it
registry.unregister(theObject);
```

It doesn't have to be the same object, though; it can be a different one:

```js
registry.register(theObject, "some value", tokenObject);
// ...some time later, if you don't care about `theObject` anymore...
// …

// some time later
registry.unregister(tokenObject);
```

Expand Down Expand Up @@ -101,7 +105,7 @@ You create the registry passing in the callback:

```js
const registry = new FinalizationRegistry(heldValue => {
// ....
//
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ const numbers = [5, 6, 2, 3, 7];

// using Math.min/Math.max apply
let max = Math.max.apply(null, numbers);
// This about equal to Math.max(numbers[0], ...)
// or Math.max(5, 6, ...)
// This about equal to Math.max(numbers[0], )
// or Math.max(5, 6, )

let min = Math.min.apply(null, numbers);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ doSomething.name; // "doSomething"

### Function constructor name

Functions created with the syntax `new Function(...)` or just `Function(...)` create {{jsxref("Function")}} objects and their name is "anonymous".
Functions created with the syntax `new Function()` or just `Function()` create {{jsxref("Function")}} objects and their name is "anonymous".

```js
(new Function).name; // "anonymous"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const generator = infinite(); // "Generator { }"
console.log(generator.next().value); // 0
console.log(generator.next().value); // 1
console.log(generator.next().value); // 2
// ...
//
```

## Specifications
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ You can then iterate through the returned array as shown below:

```js
Intl.supportedValuesOf("calendar").forEach(function(calendar) {
// "buddhist", "chinese", "coptic", "dangi", ...
// "buddhist", "chinese", "coptic", "dangi", etc.
});
```

Expand All @@ -73,23 +73,23 @@ The other values are all obtained in the same way:

```js
Intl.supportedValuesOf("collation").forEach(function(collation) {
// "big5han", "compat", "dict", "emoji", ...
// "big5han", "compat", "dict", "emoji", etc.
});

Intl.supportedValuesOf("currency").forEach(function(currency) {
// "ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", ...
// "ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", etc.
});

Intl.supportedValuesOf("numberingSystem").forEach(function(numberingSystem) {
// "adlm", "ahom", "arab", "arabext", "bali", ...
// "adlm", "ahom", "arab", "arabext", "bali", etc.
});

Intl.supportedValuesOf("timeZone").forEach(function(timeZone) {
// "Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa/Algiers", ...
// "Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa/Algiers", etc.
});

Intl.supportedValuesOf("unit").forEach(function(unit) {
// "acre", "bit", "byte", "celsius", "centimeter", ...
// "acre", "bit", "byte", "celsius", "centimeter", etc.
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ pair in the `Map` object, in insertion order.

```js
// Arrow function
forEach(() => { /* ... */ } )
forEach((value) => { /* ... */ } )
forEach((value, key) => { /* ... */ } )
forEach((value, key, map) => { /* ... */ } )
forEach(() => { /* */ } )
forEach((value) => { /* */ } )
forEach((value, key) => { /* */ } )
forEach((value, key, map) => { /* */ } )

// Callback function
forEach(callbackFn)
forEach(callbackFn, thisArg)

// Inline callback function
forEach(function() { /* ... */ })
forEach(function(value) { /* ... */ })
forEach(function(value, key) { /* ... */ })
forEach(function(value, key, map) { /* ... */ })
forEach(function(value, key, map) { /* ... */ }, thisArg)
forEach(function() { /* */ })
forEach(function(value) { /* */ })
forEach(function(value, key) { /* */ })
forEach(function(value, key, map) { /* */ })
forEach(function(value, key, map) { /* */ }, thisArg)
```

### Parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ Math.ceil(-7.004); // -7
* @returns {Number} The adjusted value.
*/
function decimalAdjust(type, value, exp) {
// If the exp is undefined or zero...
// If the exp is undefined or zero
if (typeof exp === 'undefined' || +exp === 0) {
return Math[type](value);
}
value = +value;
exp = +exp;
// If the value is not a number or the exp is not an integer...
// If the value is not a number or the exp is not an integer
if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) {
return NaN;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ Math.floor(-45.95); // -46
* @returns {Number} The adjusted value.
*/
function decimalAdjust(type, value, exp) {
// If the exp is undefined or zero...
// If the exp is undefined or zero
if (typeof exp === 'undefined' || +exp === 0) {
return Math[type](value);
}
value = +value;
exp = +exp;
// If the value is not a number or the exp is not an integer...
// If the value is not a number or the exp is not an integer
if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) {
return NaN;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ sum of squares of its arguments, that is:
Math.hypot()
Math.hypot(value0)
Math.hypot(value0, value1)
Math.hypot(value0, value1, ... , valueN)
Math.hypot(value0, value1, /* … ,*/ valueN)
```

### Parameters

- `value1, value2, ...`
- `value1`, …, `valueN`
- : Numbers.

### Return value
Expand All @@ -83,7 +83,7 @@ corresponding distance in 2 or more dimensions can be calculated by adding more
under the square root: `Math.sqrt(v1*v1 + v2*v2 + v3*v3 + v4*v4)`.

This function makes this calculation easier and faster; you call
`Math.hypot(v1, v2)` , or `Math.hypot(v1, v2, v3, v4, ...)`.
`Math.hypot(v1, v2)` , or `Math.hypot(v1, /* … ,*/, vN)`.

`Math.hypot` also avoids overflow/underflow problems if the magnitude of
your numbers is very large. The largest number you can represent in JS is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The **`Math.max()`** function returns the largest of the zero or more numbers gi
Math.max()
Math.max(value0)
Math.max(value0, value1)
Math.max(value0, value1, /* ... ,*/ valueN)
Math.max(value0, value1, /* ,*/ valueN)
```

### Parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ isn't a number and can't be converted into one.
Math.min()
Math.min(value0)
Math.min(value0, value1)
Math.min(value0, value1, ... , valueN)
Math.min(value0, value1, /* … ,*/ valueN)
```

### Parameters

- `value1, value2, ...`
- `value1`, …, `valueN`
- : Zero or more numbers among which the lowest value will be selected and returned.

### Return value
Expand Down
Loading