Skip to content

arrMove

Moves the position of a specific element in an array to the specified position. (Position starts from 0.)

Parameters

NameTypeRequiredDefault
arrayany[]List<dynamic>list[Any]
fromnumberint
tonumberint

Returns

any[]

List<dynamic>

list[Any]

Examples

javascript
arrMove([1, 2, 3, 4], 1, 0); // Returns [2, 1, 3, 4]
dart
arrMove([1, 2, 3, 4], 1, 0); // Returns [2, 1, 3, 4]
python
arrMove([1, 2, 3, 4], 1, 0)  # Returns [2, 1, 3, 4]

Released under the MIT License