日期:2014-05-16  浏览次数:20372 次

js 引用

<html>

<head>
<script type="text/javascript">
// js 引用
var item = new Array("one","two");
var itemRef = item;
//item和itemRef指向同一个对象(Array)的指针
item.push("three");
alert(item.length==itemRef.length);
itemRef.push("three");
alert(item.length==itemRef.length);
itemRef = new Array("one","two","three");
alert(item == itemRef);

var it = "test";

var itRef = it;

item += "ing";//创建新对象

alert(it!=ifRef);
</script>
<body>


</body>

</head>

</html>