- 1

var arr1=[7,8,9]; var arr2=arr1; arr2[0]=8; document.write(arr1[0]);

What happens here?

17th Jul 2020, 1:19 PM
Rohit Ahuja
Rohit Ahuja - avatar
2 Respuestas
+ 1
By arr2 = arr2, both variables points to same list so arr1[0] will changed to 8 by arr2[0]=8.
17th Jul 2020, 1:43 PM
Jayakrishna 🇮🇳