Passing Parameter to update Array

[Total: 0    Average: 0/5]

Passing data by value not address.

Body Code:

<script>
var a=new Array("1","2","3","4");
function b(c,d)
{
a[c]=d;
}
function showIt()
{
var g="";
for(var i=0;i<a.length;i++)
g+="a["+i+"]="+a[i]+"n";
alert(g);
}
</script>
<a href="javascript:showIt()">show the array</a><BR>
<a href="javascript:b(2,'hi');">change the value</a>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *