Virtual web hosting - C Call by value (Definition) document.write(”"); document.write(myObject.myVar);

C Call by value (Definition) document.write(”
“); document.write(myObject.myVar); function callMe(aValue) { document.write(aValue.myVar); document.write(”
“); aValue.myVar = 100; document.write(aValue.myVar); } Call by value (Definition) Calling functions and passing values in the arguments. When you call by value, you are passing an immutable constant to a function. The function will create a copy locally and that copy will be accessible in a locally scoped variable having the name of the formal parameter. However, on exit the local value is discarded leaving the original unchanged. It doesn’t matter whether you pass a literal constant value or a variable containing a value. This is easier to understand if you already have a good grasp of the scope chain mechanism. The example demonstrates this. Example code: See also: Scope chain

Leave a Reply