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