Snippet format update
To match the starter (for the migration)
This commit is contained in:
@ -1,4 +1,7 @@
|
||||
### offset
|
||||
---
|
||||
title: offset
|
||||
tags: array,beginner
|
||||
---
|
||||
|
||||
Moves the specified amount of elements to the end of the array.
|
||||
|
||||
@ -13,4 +16,4 @@ const offset = (arr, offset) => [...arr.slice(offset), ...arr.slice(0, offset)];
|
||||
```js
|
||||
offset([1, 2, 3, 4, 5], 2); // [3, 4, 5, 1, 2]
|
||||
offset([1, 2, 3, 4, 5], -2); // [4, 5, 1, 2, 3]
|
||||
```
|
||||
```
|
||||
Reference in New Issue
Block a user