Function object

Function object

Script Function object.

Properties

name
readonly, string. name of the function. For anonymous (lambda) functions it is undefined.
fullName
readonly, string. Fully qualified name of the function, includes name of class or namespace. For anonymous (lambda) functions it is undefined.
length
readonly, integer. Returns total number of declared parameters.
optionals
readonly, integer. Returns number of optional parameters.

Methods

[this]

([arg1:string [, arg2:string [, … argN:string]],] functionBody:string)

constructor, compiles the functionBody and creates function object of it. arg1… argN are names to be used by the function as formal argument names. Each must be a string that corresponds to a valid JavaScript identifier.

call

( thisObj: object [, p0:value, … pN:value] ) : value

Invokes the function in context of this set to thisObj

apply

( thisObj: object [,p0:value, … pN:value] [, argv:array] ) : value

Invokes the function in context of this set to thisObj. Parameters of the function call are compsed from list of parameters p0 … pN and appended by members of argv array. Thus actual call will have following parameters list: p0, …, pN, argv[0], … argv[N].

exists
( tag: value, [deep = false] ) : true | false

Checks property by its tag for existence. If deep == true then does deep lookup – in function itself and its chain of classes.

remove
( tag: value ) : void

Removes property of the function by its tag (a.k.a. name).

propertyAt
( tag: value ) : value

Does lookup in the object for member/property by its tag. This is a direct equivalent of obj.tag construction.

seal
( [strict:true|false] ) : object

Locks structure of the object – after the call any attempt to add or remove object’s property will throw an error. Values of existing properties can be changed though. Returns the object iself. If strict parameter is provided and it is exactly true then any attempt to get unknown property will throw an error.

isSealed
( [strict:true|false] ) : true | false | undefined

Returns true if the object is sealed. If strict parameter is provided and is exactly true then the method returns true only if seal(true) was called for it.

freeze
( [strict:true|false] ) : object

Locks the object – makes it immutable – any attempt to add, remove and modify value of any object’s property will throw an error. Returns the object itself. If there is a strict parameter and it is exactly true then any attempt to get unknown property will throw an error.

isFrozen
( [strict:true|false] ) : true | false | undefined

Returns true if the object is frozen. If strict parameter is provided and is exactly true then the method returns true only if freeze(true) was called for it.