Language

The JavaScript statements and keywords as Docly runs them — if, switch, try, function, import, typeof and more — and Object.keys/Object.entries.

if(criteria)

Evaluates a condition and runs code if it is true. The condition uses standard JavaScript truthiness: false, 0, NaN, "" (empty text), null…

el­se

For use in if statements, runs code statement or block if criteria evaluates to "false".

func­tio­n(name, params)

Declares a function. Functions are closures (they keep access to the variables where they were defined), and parameters can have default…

re­tur­n(value)

Ends the current function and returns a value to the caller. A bare return; returns undefined.

brea­k

Ends the current for, for…of, for…in, while or do…while loop, or a switch statement, and continues with the code after it.

con­tinue

Skips the rest of the current iteration of a loop (for, for…of, for…in, while, do…while) and continues with the next iteration.

ty­peo­f(value)

The typeof operator returns a string describing the type of the value.

switc­h(value)

Runs the code after the case that matches a value — a more readable alternative to a series of if/else statements. HashJS rules: - Each…

im­por­t(filename)

Imports exported functions and values from another JavaScript file (a module), so they can be used in the current file. Supported forms: -…

try(statements, catch, finally)

Runs a block of code and catches errors with catch. An optional finally block runs whatever the outcome. The catch variable holds exactly…

Ob­ject.­ke­ys(obj)

Returns the names of an object's own properties. Works for object literals, JSON data from documents, and Docly objects such as request.…

Ob­ject­.en­trie­s(obj)

Returns an object's own properties as [key, value] pairs, in the same order as Object.keys(). Works for object literals, JSON data from…