# ghostkit/3.4.1/gutenberg/utils/array-move/index.js

Block Animations, Motion &amp; Scroll Effects – Ghost Kit, version 3.4.1. 18 lines.

- Page: https://pluginprobe.com/plugins/ghostkit/3.4.1/code/gutenberg/utils/array-move/index.js
- Raw: https://pluginprobe.com/plugins/ghostkit/3.4.1/raw/gutenberg/utils/array-move/index.js
- Modified: 2024-02-18T18:40:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ghostkit/3.4.1/code/gutenberg/utils/array-move/index.js#L10-L20`.

```javascript
/**
 * Move array element from one index to another.
 *
 * @param {Array} arr       - array.
 * @param {Int}   fromIndex - from index.
 * @param {Int}   toIndex   - to index.
 *
 * @return {Array}
 */
export default function arrayMove(arr, fromIndex, toIndex) {
	const element = arr[fromIndex];

	arr.splice(fromIndex, 1);
	arr.splice(toIndex, 0, element);

	return arr;
}

```
