References in JavaScript (consistent with C)
Javascript can be used as an object-orientedProgramming LanguageAnd has the characteristics of object-oriented language.
Here we will talk about the referenced features
References can be used in JS to demonstrate the same performance as the C # language.
Instance 1:
VaR obj1 = new object ()
VaR obj2 = obj1;
Obj1.name = "Hello World ";
Alert (obj2.name = obj1.name) // The value is true.
Instance 2:
VaR Item1 = new array ('A', 'B', 'C ');
VaR item2 = Item1;
Item1.push ('D ');
Alert (item2.length) // you will find that = 4 is consistent with Item1
Instance 3: String instance
VaR str1 = 'hello ';
VaR str2 = str1;
Str1 + = 'World ';
Alert (str2); // It is still hello.
The performance in this region is the same as that in C #. Each concatenation or modification of a string object will generate a new object. The original object will be invalid or has no reference.
This document uses the unregistered version of blog_backup for export. Please register with soft.pt42.com.