实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<body>
4
5
<p id="demo">Click the button to reverse the order of the elements in the array.</p>
6
7
<button onclick="myFunction()">Try it</button>
8
9
<script>
10
var fruits = ["Banana", "Orange", "Apple", "Mango"];
11
12
function myFunction()
13
{
14
fruits.reverse();
15
var x=document.getElementById("demo");
16
x.innerHTML=fruits;
17
}
18
</script>
19
20
</body>
21
</html>