Skip to content

Commit

Permalink
Fix typo in .toSpliced() method (#3001)
Browse files Browse the repository at this point in the history
* Fix typo in a comment

* review edits

---------

Co-authored-by: vide-onirique <[email protected]>
Co-authored-by: Caupolican Diaz <[email protected]>
Co-authored-by: SSwiniarski <[email protected]>
  • Loading branch information
4 people authored Aug 13, 2023
1 parent b43fde5 commit 231cef8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions content/javascript/concepts/arrays/terms/toSpliced/toSpliced.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CatalogContent:
- 'paths/front-end-engineer-career-path'
---

**`.toSpliced()`** is a method that modifies multiple array elements. It has a start point (the first element to be modified) and an endpoint (the last element to be modified). `.toSpliced()` can make the following changes to an array:
**`.toSpliced()`** is a method that modifies multiple array elements. It has a starting point (the first element to be modified) and an end point (the last element to be modified). `.toSpliced()` can make the following changes to an array:

- Extract element(s)
- Replace element(s)
Expand All @@ -33,7 +33,7 @@ myArray.toSpliced(startIndex, count, elementN)

## Examples

### Extract Array Elements With `.toSpliced`
### Extracting Array Elements

```js
const colors = ['red', 'yellow', 'blue', 'orange', 'green', 'purple'];
Expand All @@ -49,12 +49,12 @@ console.log(colors);
// Output: 'red', 'yellow', 'blue', 'orange', 'green', 'purple'
```

### Replace Array Elements Using `.toSpliced()`
### Replacing Array Elements

```js
const colors = ['red', 'yellow', 'blue', 'orange', 'green', 'purple'];

// Replacing red, green, and yellow. Start at index 0, and replace three items.
// Replacing red, yellow, and blue. Start at index 0, and replace three items.
const tertiaryColors = colors.toSpliced(
0,
3,
Expand All @@ -70,7 +70,7 @@ console.log(colors);
// Output: 'red', 'yellow', 'blue', 'orange', 'green', 'purple'
```

### Insert New Items Into an Array Using `.toSpliced`
### Inserting New Items Into an Array

```js
const colors = ['red', 'yellow', 'blue', 'orange', 'green', 'purple'];
Expand Down

0 comments on commit 231cef8

Please sign in to comment.