先自測一下,答案在最下邊。javascript
<html> <head> <script type="text/javascript" src="/jquery/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("button").click(function(){ var a = 5; var b = a; alert(b); a = 10; alert(b); var arr_a =[]; arr_a[0] = 0; var arr_b = []; arr_b = arr_a; alert(arr_b[0]); arr_a[0] = 10; alert(arr_b[0]); }); }); </script> </head> <body> <h2>This is a heading</h2> <p>This is a paragraph.</p> <p>This is another paragraph.</p> <button type="button">Click me</button> </body> </html>
運行結果彈窗顯示依次是:html
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.java
5 5 0 10jquery