On this page:
new
8.18
top
up

6FunctionsπŸ”— i

syntax

( functionmaybe-id(param-id...)maybe-varsbody...+)

maybe-id =
| id
maybe-vars =
| #:vars(var-id...)
Produces an ECMAScript function. Each parameter param-id is bound as a parameter in the ECMAScript environment, but is not bound as a Racket variable.

If id is provided, it is the name of the function.

If maybe-vars is provided, each var-id is initialized as an ECMAScript variable binding.

syntax

( return)

(returnexpr)
Return early from the enclosing function. If expr is provided it will be the return value. This form is illegal outside of a function body.

syntax

this

Binds to the ECMAScript this value for the current execution context.

procedure

( callrefarg...)(or/cvalue?void?)

ref:function?
arg:value?
Invokes the function from ref. Each arg is bound to a formal parameter of the function in order. Surplus arguments are ignored, and if insufficient arguments are passed the remaining parameters will be undefined .

The this value will be bound to the base of ref if it is a reference, or to the function itself otherwise.

procedure

( newrefarg...)object?

arg:value?
Invokes ref as a constructor, with each arg bound to a formal parameter. Surplus arguments are ignored, and any remaining parameters are bound to undefined .

6.1Function PredicatesπŸ”— i

procedure

( function? v)boolean?

v:any/c
Returns #t if v is an ECMAScript function, #f otherwise.

procedure

( constructor? v)boolean?

v:any/c
Returns #t if v is an ECMAScript function which can be used in a new expression, #f otherwise.

top
up

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /