program to swap methods in javascript angular code example Example: switch element array angular [elements[0], elements[3]] = [elements[3], elements[0]];