The js array element is interchanged with the beginning element

clipboard.png

The

code is as follows
move dikuai to the first bit in the array

Mar.11,2021

since you know that elements need to be reversed, your processing is too troublesome. Introducing an intermediate variable can be
or even unnecessary (because you clearly know the
of the element 'diKuai'), so you can

.
arr[arr.indexOf('diKuai')]=arr[0];
arr[0]='diKuai';

that is, the data exchange between the two values. The ab value exchange introduces the c variable. You can also use cool techs & and |

.
Menu