1<script>2 functionWF (W) {3 Console.log (w);4 }5 6 varWA = [3,66,7];7 varWB =wa;8Wa.splice ();9 WF (WA);Ten WF (WB); One A varWaa = [3,66,7]; - varWBB =Waa; -Waa = [123,4]; the WF (WAA); - WF (WBB); - - varWae = [3,66,7]; + varWBE =Wae; -Wbe.splice (); + WF (WAE); A WF (WBE); at - vararr =NewArray (); - WF (arr); -</script>
[3, 7]
[3, 7]
[123, 4]
[3, 66, 7]
[3, 7]
[3, 7]
professional.javascript.for.web.developers.3rd.edition.jan.2012
4 Variables, Scope, and Memory
PRIMITIVE and REFERENCE valuesecmascript variables may contain the different types of data:primitive values and REFERENCE Values. Primitive values is simple atomic pieces of the data, while reference values is objects that may is made up of multiple Valu Es. When a value was assigned to a variable, the JavaScript engine must determine if it ' s a primitive or a reference. The five primitive types were discussed in the previous chapter:undefined, Null, Boolean, number, and String. These variables is said to being accessed by value, because is manipulating the actual value stored in the variable. Reference values is objects stored in memory. Unlike other languages, JavaScript does not permit direct access to memory locations, so direct manipulation of the object ' s memory space is not allowed. When you manipulate an object, you ' re really working on a reference to that object rather than the actual object itself. For this reason, such values is said to being accessed by reference.
= Splice