Specify the Java aliasing problem in Java script array? Give proper Example when and where needed
Array types (composite type as well) are reference types, so problem of aliasing is there
var firstArray = [“Mars”, “Jupiter”, “Saturn” ];
var secondArray = firstArray;
secondArray[0] = “Neptune”;
alert(firstArray); // it has been changed
var firstArray = [“Mars”, “Jupiter”, “Saturn” ];
var secondArray = firstArray;
secondArray[0] = “Neptune”;
alert(firstArray); // it has been changed
Specify Java aliasing problem in Java script array?
Reviewed by MCH
on
March 01, 2014
Rating:
No comments: