Skip to content

Commit

Permalink
javascript-101/arrays: add info on second parameter of .slice()
Browse files Browse the repository at this point in the history
Fixes gh-611
Closes gh-612
  • Loading branch information
arthurvr committed Jan 19, 2015
1 parent 7c3105e commit 3296aa2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions page/javascript-101/arrays.md
Expand Up @@ -172,6 +172,12 @@ console.log( myArray ); // [ 1, 2, 3, 4, 5, 6, 7, 8 ]
console.log( newArray ); // [ 4, 5, 6, 7, 8 ]
```

The `.slice()` method takes an optional second parameter, the end index.

```
console.log( [ 1, 2, 3, 4, 5, 6, 7, 8 ].slice( 2, 5 ) ); // [ 3, 4, 5 ]
```

### .splice()

Removes a certain amount of elements and adds new ones at the given index. It takes at least three parameters:
Expand Down

0 comments on commit 3296aa2

Please sign in to comment.