Several operators can be applied to objects of any type.
as() operators coerces objects of one type to be an object of another. The target type is given as a string argument to the operator. The following types are available:
The following coercions are valid:
nullif not parsable) and regular expressions.
nulland false can be coerced to 0, and
truecan be coerced to
An error is thrown for other attempted coercions, unless the value being coerced by
as() is already of the target type.
For example, the following constructs a string and then turns it into a regular expression that can be used by the replace() operator:
defaultsTo() operator returns the value of its first argument if the object is null. The second argument is a string and is optional. If present, it is written in the log if the object is null.
The operator is most often used to guard against null values.
isnull() operator returns true of the object is null (undefined) and false otherwise.
klog() operator writes an optional message, given as a string argument, and the value of the object to the debug log.
typeof() operator returns the type of the object to which it is applied. The return value is one of the strings that may be passed to
as(), or one of the other following values: