import { Callout } from "nextra/components"; import REPL from "../../components/REPL";
Immutable: This does not mutate the given array.It moves an array element from one index position to another.
import { move } from '@opentf/std';
move(arr: T[], from: number, to: number): T[];
import { move } from "@opentf/std";
move([], 0, 1);
move([1, 2, 3], 0, 2); //=> [2, 3, 1]
move([1, 2, 3], 0, 5); //=> [2, 3, 1]
move([1, 2, 3], 5, 0); //=> [1, 2, 3]
<REPL code={`const { move } = require('@opentf/std');
move([1, 2, 3], 0, 2);`} />