怎样颠倒其中的两个数据?
先定义一个中间变量,如var temp;
然后交换要颠倒的元素的值,如temp=arr[i];arr[i]=arr[j];arr[j]=temp;
<script type="text/javascript">
var myarr1= ["1","2",];
document.write(myarr1.reverse())
var a = 1;
var b = 2;
var c;
c=a;
a=b;
b=c;