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