diff --git a/files/en-us/web/javascript/reference/global_objects/array/filter/index.md b/files/en-us/web/javascript/reference/global_objects/array/filter/index.md index 081fb06ed3b589d..f6a54ce7e0c4854 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/filter/index.md +++ b/files/en-us/web/javascript/reference/global_objects/array/filter/index.md @@ -33,7 +33,7 @@ filter(callbackFn, thisArg) ### Return value -A [shallow copy](/en-US/docs/Glossary/Shallow_copy) of a portion of the given array, filtered down to just the elements from the given array that pass the test implemented by the provided function. If no elements pass the test, an empty array will be returned. +A [shallow copy](/en-US/docs/Glossary/Shallow_copy) of the given array containing just the elements that pass the test. If no elements pass the test, an empty array is returned. ## Description diff --git a/files/en-us/web/javascript/reference/global_objects/array/findlast/index.md b/files/en-us/web/javascript/reference/global_objects/array/findlast/index.md index 713e44bae0ce2e5..44fca83a6945954 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/findlast/index.md +++ b/files/en-us/web/javascript/reference/global_objects/array/findlast/index.md @@ -44,7 +44,7 @@ findLast(callbackFn, thisArg) ### Return value -The value of the element in the array with the highest index value that satisfies the provided testing function; {{jsxref("undefined")}} if no matching element is found. +The last (highest-index) element in the array that satisfies the provided testing function; {{jsxref("undefined")}} if no matching element is found. ## Description @@ -191,7 +191,7 @@ console.log( ## See also -- [Polyfill of `Array.prototype.findLast` in `core-js`](https://github.com/zloirock/core-js#ecmascript-array) +- [Polyfill of `Array.prototype.findLast` in `core-js`](https://github.com/zloirock/core-js#array-find-from-last) - [Indexed collections](/en-US/docs/Web/JavaScript/Guide/Indexed_collections) guide - {{jsxref("Array")}} - {{jsxref("Array.prototype.find()")}} diff --git a/files/en-us/web/javascript/reference/global_objects/array/findlastindex/index.md b/files/en-us/web/javascript/reference/global_objects/array/findlastindex/index.md index 5410d1b7e42a808..79a678da6c28a13 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/findlastindex/index.md +++ b/files/en-us/web/javascript/reference/global_objects/array/findlastindex/index.md @@ -37,7 +37,7 @@ findLastIndex(callbackFn, thisArg) ### Return value The index of the last (highest-index) element in the array that passes the test. -Otherwise -1 if no matching element is found. +Otherwise `-1` if no matching element is found. ## Description @@ -113,7 +113,8 @@ console.log( ## See also -- [Polyfill of `Array.prototype.findIndex` in `core-js`](https://github.com/zloirock/core-js#ecmascript-array) +- [Polyfill of `Array.prototype.findLastIndex` in `core-js`](https://github.com/zloirock/core-js#array-find-from-last) +- [Indexed collections](/en-US/docs/Web/JavaScript/Guide/Indexed_collections) guide - {{jsxref("Array")}} - {{jsxref("Array.prototype.find()")}} - {{jsxref("Array.prototype.findIndex()")}} diff --git a/files/en-us/web/javascript/reference/global_objects/array/indexof/index.md b/files/en-us/web/javascript/reference/global_objects/array/indexof/index.md index ee825b3870bdc84..1afa83ae4f744a4 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/indexof/index.md +++ b/files/en-us/web/javascript/reference/global_objects/array/indexof/index.md @@ -31,7 +31,7 @@ indexOf(searchElement, fromIndex) ### Return value -The first index of the element in the array; `-1` if not found. +The first index of `searchElement` in the array; `-1` if not found. ## Description diff --git a/files/en-us/web/javascript/reference/global_objects/array/join/index.md b/files/en-us/web/javascript/reference/global_objects/array/join/index.md index a855ac8270c2b1d..d91181873011355 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/join/index.md +++ b/files/en-us/web/javascript/reference/global_objects/array/join/index.md @@ -28,8 +28,7 @@ join(separator) ### Return value -A string with all array elements joined. If `arr.length` is -`0`, the empty string is returned. +A string with all array elements joined. If `array.length` is `0`, the empty string is returned. ## Description diff --git a/files/en-us/web/javascript/reference/global_objects/array/lastindexof/index.md b/files/en-us/web/javascript/reference/global_objects/array/lastindexof/index.md index c0b55648b0c64fa..d9bc813f9068854 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/lastindexof/index.md +++ b/files/en-us/web/javascript/reference/global_objects/array/lastindexof/index.md @@ -32,7 +32,7 @@ lastIndexOf(searchElement, fromIndex) ### Return value -The last index of the element in the array; `-1` if not found. +The last index of `searchElement` in the array; `-1` if not found. ## Description diff --git a/files/en-us/web/javascript/reference/global_objects/array/reduce/index.md b/files/en-us/web/javascript/reference/global_objects/array/reduce/index.md index 9f95920bba93a62..cd25395dc4b77a1 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/reduce/index.md +++ b/files/en-us/web/javascript/reference/global_objects/array/reduce/index.md @@ -36,7 +36,7 @@ reduce(callbackFn, initialValue) - `currentValue` - : The value of the current element. On the first call, its value is `array[0]` if `initialValue` is specified; otherwise its value is `array[1]`. - `currentIndex` - - : The index position of `currentValue` in the typed array. On the first call, its value is `0` if `initialValue` is specified, otherwise `1`. + - : The index position of `currentValue` in the array. On the first call, its value is `0` if `initialValue` is specified, otherwise `1`. - `array` - : The array `reduce()` was called upon. - `initialValue` {{optional_inline}} diff --git a/files/en-us/web/javascript/reference/global_objects/array/reduceright/index.md b/files/en-us/web/javascript/reference/global_objects/array/reduceright/index.md index a5219b249021dbb..ea856e91c8e4d59 100644 --- a/files/en-us/web/javascript/reference/global_objects/array/reduceright/index.md +++ b/files/en-us/web/javascript/reference/global_objects/array/reduceright/index.md @@ -31,7 +31,7 @@ reduceRight(callbackFn, initialValue) - `currentValue` - : The value of the current element. On the first call, its value is the last element if `initialValue` is specified; otherwise its value is the second-to-last element. - `currentIndex` - - : The index position of `currentValue` in the typed array. On the first call, its value is `array.length - 1` if `initialValue` is specified, otherwise `array.length - 2`. + - : The index position of `currentValue` in the array. On the first call, its value is `array.length - 1` if `initialValue` is specified, otherwise `array.length - 2`. - `array` - : The array `reduceRight()` was called upon. - `initialValue` {{optional_inline}} diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/at/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/at/index.md index 8686c1423ba7e42..ac6115e81a54f16 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/at/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/at/index.md @@ -20,7 +20,7 @@ at(index) ### Parameters - `index` - - : Zero-based index of the array element to be returned, [converted to an integer](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#integer_conversion). Negative index counts back from the end of the array — if `index < 0`, `index + array.length` is accessed. + - : Zero-based index of the typed array element to be returned, [converted to an integer](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#integer_conversion). Negative index counts back from the end of the typed array — if `index < 0`, `index + array.length` is accessed. ### Return value diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/copywithin/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/copywithin/index.md index e8e5159ee9def34..4e2809002008a00 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/copywithin/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/copywithin/index.md @@ -29,7 +29,7 @@ copyWithin(target, start, end) ### Return value -The modified array. +The modified typed array. ## Description diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/every/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/every/index.md index 70b937f573208d2..526e2ee67497cbc 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/every/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/every/index.md @@ -33,7 +33,7 @@ every(callbackFn, thisArg) ### Return value -`true` if `callbackFn` returns a {{Glossary("truthy")}} value for every array element. Otherwise, `false`. +`true` unless `callbackFn` returns a {{Glossary("falsy")}} value for a typed array element, in which case `false` is immediately returned. ## Description diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/fill/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/fill/index.md index c49b7f02aac7c30..a516986a6087d5a 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/fill/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/fill/index.md @@ -30,7 +30,7 @@ fill(value, start, end) ### Return value -The modified array, filled with `value`. +The modified typed array, filled with `value`. ## Description diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/filter/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/filter/index.md index b0ce7c2982fcb66..560e7f9b32f1d52 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/filter/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/filter/index.md @@ -33,7 +33,7 @@ filter(callbackFn, thisArg) ### Return value -A new typed array with the elements that pass the test. If no elements pass the test, an empty array will be returned. +A copy of the given typed array containing just the elements that pass the test. If no elements pass the test, an empty typed array is returned. ## Description diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/findindex/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/findindex/index.md index 4b5753ff6880111..6de911a0f8f6336 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/findindex/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/findindex/index.md @@ -33,7 +33,7 @@ findIndex(callbackFn, thisArg) ### Return value -The index of the first element in the array that passes the test. Otherwise, `-1`. +The index of the first element in the typed array that passes the test. Otherwise, `-1`. ## Description diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/findlast/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/findlast/index.md index 280645ed12d7c6f..08765cb2f6160ed 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/findlast/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/findlast/index.md @@ -33,7 +33,7 @@ findLast(callbackFn, thisArg) ### Return value -The element in the typed array with the highest index value that satisfies the provided testing function; {{jsxref("undefined")}} if no matching element is found. +The last (highest-index) element in the typed array that satisfies the provided testing function; {{jsxref("undefined")}} if no matching element is found. ## Description @@ -116,7 +116,7 @@ uint8.findLast((value, index) => { ## See also -- [Polyfill of `TypedArray.prototype.findLast()` in `core-js`](https://github.com/zloirock/core-js#ecmascript-typed-arrays) +- [Polyfill of `TypedArray.prototype.findLast` in `core-js`](https://github.com/zloirock/core-js#array-find-from-last) - [JavaScript typed arrays](/en-US/docs/Web/JavaScript/Guide/Typed_arrays) guide - {{jsxref("TypedArray")}} - {{jsxref("TypedArray.prototype.find()")}} diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/findlastindex/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/findlastindex/index.md index 43eddbe01e5face..6464508bbc8ee32 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/findlastindex/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/findlastindex/index.md @@ -33,8 +33,8 @@ findLastIndex(callbackFn, thisArg) ### Return value -The index of the last (highest-index) element in the array that passes the test. -Otherwise -1 if no matching element is found. +The index of the last (highest-index) element in the typed array that passes the test. +Otherwise `-1` if no matching element is found. ## Description @@ -77,7 +77,7 @@ console.log(uint8.findLastIndex(isPrime)); ## See also -- [Polyfill of `TypedArray.prototype.findLastIndex` in `core-js`](https://github.com/zloirock/core-js#ecmascript-typed-arrays) +- [Polyfill of `TypedArray.prototype.findLastIndex` in `core-js`](https://github.com/zloirock/core-js#array-find-from-last) - [JavaScript typed arrays](/en-US/docs/Web/JavaScript/Guide/Typed_arrays) guide - {{jsxref("TypedArray")}} - {{jsxref("TypedArray.prototype.find()")}} diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/includes/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/includes/index.md index f6713a9eda43b57..f356b6da4832593 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/includes/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/includes/index.md @@ -27,7 +27,7 @@ includes(searchElement, fromIndex) ### Return value -A boolean value which is `true` if the value `searchElement` is found within the array (or the part of the array indicated by the index `fromIndex`, if specified). +A boolean value which is `true` if the value `searchElement` is found within the typed array (or the part of the typed array indicated by the index `fromIndex`, if specified). ## Description diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/indexof/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/indexof/index.md index 5bb3d20e9144f5d..ef2791f5dfc47e8 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/indexof/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/indexof/index.md @@ -27,7 +27,7 @@ indexOf(searchElement, fromIndex) ### Return value -The first index of the element in the array; `-1` if not found. +The first index of `searchElement` in the typed array; `-1` if not found. ## Description diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/join/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/join/index.md index f0e65ddec7c1d25..0f09d552587f71f 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/join/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/join/index.md @@ -21,12 +21,11 @@ join(separator) ### Parameters - `separator` {{optional_inline}} - - : A string to separate each pair of adjacent elements of the array. If omitted, the typed array elements are separated with a comma (","). + - : A string to separate each pair of adjacent elements of the typed array. If omitted, the typed array elements are separated with a comma (","). ### Return value -A string with all array elements joined. If `arr.length` is -`0`, the empty string is returned. +A string with all typed array elements joined. If `array.length` is `0`, the empty string is returned. ## Description diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/lastindexof/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/lastindexof/index.md index 3afa3404e992840..e1fafb203eae765 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/lastindexof/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/lastindexof/index.md @@ -22,12 +22,12 @@ lastIndexOf(searchElement, fromIndex) - `searchElement` - : Element to locate in the typed array. -- `fromIndex` +- `fromIndex` {{optional_inline}} - : Zero-based index at which to start searching backwards, [converted to an integer](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#integer_conversion). ### Return value -The last index of the element in the array; `-1` if not found. +The last index of `searchElement` in the typed array; `-1` if not found. ## Description diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/reduce/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/reduce/index.md index a7e479693b3157f..7d5cddfe524d801 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/reduce/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/reduce/index.md @@ -37,7 +37,7 @@ reduce(callbackFn, initialValue) ### Return value -The value that results from running the "reducer" callback function to completion over the entire array. +The value that results from running the "reducer" callback function to completion over the entire typed array. ### Exceptions @@ -73,3 +73,5 @@ const total = new Uint8Array([0, 1, 2, 3]).reduce((a, b) => a + b); - {{jsxref("TypedArray.prototype.map()")}} - {{jsxref("TypedArray.prototype.reduceRight()")}} - {{jsxref("Array.prototype.reduce()")}} +- {{jsxref("Object.groupBy()")}} +- {{jsxref("Map.groupBy()")}} diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/reduceright/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/reduceright/index.md index e9a95444ee2a830..07ed87d1523dd5a 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/reduceright/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/reduceright/index.md @@ -23,7 +23,7 @@ reduceRight(callbackFn, initialValue) - `callbackFn` - : A function to execute for each element in the typed array. Its return value becomes the value of the `accumulator` parameter on the next invocation of `callbackFn`. For the last invocation, the return value becomes the return value of `reduceRight()`. The function is called with the following arguments: - `accumulator` - - : The value resulting from the previous call to `callbackFn`. On the first call, its value is `initialValue` if the latter is specified; otherwise its value is the last element of the array. + - : The value resulting from the previous call to `callbackFn`. On the first call, its value is `initialValue` if the latter is specified; otherwise its value is the last element of the typed array. - `currentValue` - : The value of the current element. On the first call, its value is the last element if `initialValue` is specified; otherwise its value is the second-to-last element. - `currentIndex` @@ -66,3 +66,5 @@ const total = new Uint8Array([0, 1, 2, 3]).reduceRight((a, b) => a + b); - {{jsxref("TypedArray.prototype.map()")}} - {{jsxref("TypedArray.prototype.reduce()")}} - {{jsxref("Array.prototype.reduceRight()")}} +- {{jsxref("Object.groupBy()")}} +- {{jsxref("Map.groupBy()")}} diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/slice/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/slice/index.md index a4e8f3032cd7f5d..808005a397a891c 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/slice/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/slice/index.md @@ -22,11 +22,8 @@ slice(start, end) ### Parameters - `start` {{optional_inline}} - - : Zero-based index at which to start extraction, [converted to an integer](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#integer_conversion). - - `end` {{optional_inline}} - - : Zero-based index at which to end extraction, [converted to an integer](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#integer_conversion). `slice()` extracts up to but not including `end`. ### Return value diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/some/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/some/index.md index 09bb309ca2a2b71..a44479d26ae6730 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/some/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/some/index.md @@ -33,7 +33,7 @@ some(callbackFn, thisArg) ### Return value -`true` if the callback function returns a {{Glossary("truthy")}} value for at least one element in the typed array. Otherwise, `false`. +`false` unless `callbackFn` returns a {{Glossary("truthy")}} value for a typed array element, in which case `true` is immediately returned. ## Description diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/sort/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/sort/index.md index 752047a3db0d072..4330a0eb076706b 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/sort/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/sort/index.md @@ -29,11 +29,11 @@ sort(compareFn) - `b` - : The second element for comparison. Will never be `undefined`. - If omitted, the array elements are sorted according to numeric value. + If omitted, the typed array elements are sorted according to numeric value. ### Return value -The reference to the original array, now sorted. Note that the array is sorted _[in place](https://en.wikipedia.org/wiki/In-place_algorithm)_, and no copy is made. +The reference to the original typed array, now sorted. Note that the typed array is sorted _[in place](https://en.wikipedia.org/wiki/In-place_algorithm)_, and no copy is made. ## Description diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/tosorted/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/tosorted/index.md index c2c824e187c752f..4d2421ba9bd0d49 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/tosorted/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/tosorted/index.md @@ -7,7 +7,7 @@ browser-compat: javascript.builtins.TypedArray.toSorted {{JSRef}} -The **`toSorted()`** method of {{jsxref("TypedArray")}} instances is the [copying](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#copying_methods_and_mutating_methods) version of the {{jsxref("TypedArray/sort", "sort()")}} method. It returns a new typed array with the elements sorted in ascending order. This method has the same algorithm as {{jsxref("Array.prototype.toSorted()")}}. +The **`toSorted()`** method of {{jsxref("TypedArray")}} instances is the [copying](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#copying_methods_and_mutating_methods) version of the {{jsxref("TypedArray/sort", "sort()")}} method. It returns a new typed array with the elements sorted in ascending order. This method has the same algorithm as {{jsxref("Array.prototype.toSorted()")}}, except that it sorts the values numerically instead of as strings by default. ## Syntax @@ -20,7 +20,7 @@ toSorted(compareFn) - `compareFn` {{optional_inline}} - - : Specifies a function that defines the sort order. If omitted, the array elements are converted to strings, then sorted according to each character's Unicode code point value. + - : Specifies a function that defines the sort order. If omitted, the typed array elements are sorted according to numeric value. - `a` - : The first element for comparison. diff --git a/files/en-us/web/javascript/reference/global_objects/typedarray/with/index.md b/files/en-us/web/javascript/reference/global_objects/typedarray/with/index.md index 0da77be2c3f70d0..712f374186e6ac6 100644 --- a/files/en-us/web/javascript/reference/global_objects/typedarray/with/index.md +++ b/files/en-us/web/javascript/reference/global_objects/typedarray/with/index.md @@ -18,7 +18,7 @@ arrayInstance.with(index, value) ### Parameters - `index` - - : Zero-based index at which to change the array, [converted to an integer](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#integer_conversion). + - : Zero-based index at which to change the typed array, [converted to an integer](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#integer_conversion). - `value` - : Any value to be assigned to the given index.