typescript swap array values code example Example: swap elements in array typescript [elements[0], elements[3]] = [elements[3], elements[0]];