Hello i try make it like:
<html><head> <script type="text/javascript">
function Code()
{
A=["T1","T2","T3",4,2,1];
var B1=A;var B2=A;var B3=A;
if (A[0]=="T2") {B1[3]=5;}
if (A[1]=="T2") {B2[3]=5;}
if (A[2]=="T2") {B3[3]=5;}
document.getElementById('W1').innerHTML="B1:"+B1[3]
document.getElementById('W2').innerHTML="B2:"+B2[3];
document.getElementById('W3').innerHTML="B3:"+B3[3];
}
</script></head><body>
<input type="button" value="Code it!" onClick="Code()"><br><br><br>
<div id="W1"></div>
<div id="W2"></div>
<div id="W3"></div>
</body>
when i press button then i got 5 on all B1, B2 and B3. but it should be only B2 have 5 while other got 4.
Why it going wrong?