typescript swap array elements between two array code example Example: switch element array angular [elements[0], elements[3]] = [elements[3], elements[0]];