function moveArrayItem(args) {
if (args.fromIndex < 0 || args.fromIndex >= args.array.length || args.toIndex < 0 || args.toIndex >= args.array.length) {
throw new Error ("Index out of bounds");
}
const newArray = [...args.array];
const [item] = newArray.splice(args.fromIndex, 1);
newArray.splice(args.toIndex, 0, item);
return newArray;
}