function swap swap<T>(list: T[],i: number,j: number): T[] Returns a new list with the elements at indices i and j swapped. Examples Example 1 swap([1, 2, 3, 4], 0, 3); // [4, 2, 3, 1] Type Parameters T Parameters list: T[] i: number j: number Return Type T[]