Skip to content

Commit

Permalink
Unify wording (#37691)
Browse files Browse the repository at this point in the history
* Update index.md

* fix others

---------

Co-authored-by: Joshua Chen <[email protected]>
  • Loading branch information
zhangenming and Josh-Cena authored Jan 17, 2025
1 parent bf55088 commit 9d3e6e4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ const result = inventory.find(({ name }) => name === "cherries");
console.log(result); // { name: 'cherries', quantity: 5 }
```

### Find a prime number in an array
### Find the first prime number in an array

The following example finds an element in the array that is a prime number (or returns {{jsxref("undefined")}} if there is no prime number):
The following example returns the first element in the array that is a prime number, or {{jsxref("undefined")}} if there is no prime number.

```js
function isPrime(element, index, array) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The `findIndex()` method is [generic](/en-US/docs/Web/JavaScript/Reference/Globa

## Examples

### Find the index of a prime number in an array
### Find the index of the first prime number in an array

The following example returns the index of the first element in the array that is a prime number, or `-1` if there is no prime number.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ See {{jsxref("Array.prototype.find()")}} for more details. This method is not ge

## Examples

### Find a prime number in a typed array
### Find the first prime number in a typed array

The following example finds an element in the typed array that is a prime number (or returns {{jsxref("undefined")}} if there is no prime number).
The following example returns the first element in the typed array that is a prime number, or {{jsxref("undefined")}} if there is no prime number.

```js
function isPrime(element, index, array) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ See {{jsxref("Array.prototype.findIndex()")}} for more details. This method is n

## Examples

### Find the index of a prime number in a typed array
### Find the index of the first prime number in a typed array

The following example finds the index of an element in the typed array that is a prime
number (or returns `-1` if there is no prime number).
The following example returns the index of the first element in the typed array that is a prime number, or `-1` if there is no prime number.

```js
function isPrime(element, index, array) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ See {{jsxref("Array.prototype.findLast()")}} for more details. This method is no

### Find the last prime number in a typed array

The following example returns the value of the last element in the typed array that is a prime number, or {{jsxref("undefined")}} if there is no prime number.
The following example returns the last element in the typed array that is a prime number, or {{jsxref("undefined")}} if there is no prime number.

```js
function isPrime(element) {
Expand Down

0 comments on commit 9d3e6e4

Please sign in to comment.