var arr1=[7,8,9]; var arr2=arr1; arr2[0]=8; document.write(arr1[0]); | Sololearn: Learn to code for FREE!

-1

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

What happens here?

7/17/2020 1:19:11 PM

Rohit Ahuja

2 Answers

New Answer

+1

By arr2 = arr2, both variables points to same list so arr1[0] will changed to 8 by arr2[0]=8.