Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array equivalents

Status
Not open for further replies.

dexeloper

Programmer
Oct 26, 2004
162
GB
Am I the only person who didn't know that if you say
arrA = arrB then changing an element in arrA also changes the equivalent element in arrB.
Try this page:

<html><head>
<script language = "JavaScript" type="text/javascript">
function xx() {
var arrB = [];
arrB[0] = "AAA";
var arrA = arrB;
alert(arrB[0]);
arrA[0] = "trtrtrtrtr";
alert(arrB[0]);
}
</script>
</head>
<body>
<input type='button' onclick='javascript:xx()'>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top