Complex data types, like Array, pass values by reference.
The following data types are passed by value:
String
Number
int
uint
Boolean
Null
void
All other data types are passed by reference.
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var person:Object = {name:" P Gibbons"};
capitalizeEmployeeName(person);
trace(person.name); // Displays: PETER GIBBONS
}
function capitalizeEmployeeName(employee:Object):void {
if (employee.name != null) {
employee.name = employee.name.toUpperCase();
}
}
}
}
Related examples in the same category