11 lines
449 B
Plaintext
11 lines
449 B
Plaintext
foo(); # without arguments
|
|
foo(1, 2); # with two arguments
|
|
foo(args...); # with a variable number of arguments
|
|
foo(name: 'Bar', age: 42); # with named arguments
|
|
|
|
var f = foo; # store the function foo inside 'f'
|
|
var result = f(); # obtain the return value of a function
|
|
|
|
var arr = [1,2,3];
|
|
foo(arr); # the arguments are passed by object-reference
|