# State Function Reference

A state is an anonymous JavaScript function with one input parameter. This function will determine the event (a moment in time or interaction of a client) and submit a callback.

**Anonymous Function Input Parameter**: {function} initState

The state code statement must begin with an anonymous function with an input object. That input is a callback function and must be called whenever this JENTIS State is determined to be activated.

Further the initState (callback function) takes an Object as the input with certain properties. This object and its properties is optional and only for advanced users.

initState input Object properties:

* stateCallback: if you want to call a function after this JENTIS State was processed this is the place to go.
* contextualStateInformation: this is a customizable Object that you can submit when this JENTIS State is processed and access this properties and values in JENTIS Frontend Variables.

For the usage of this advanced settings please see in the section below for a detailed use case running through this options.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.jentis.com/jentis-dcp-elements/states/state-registry-creating-and-managing-jentis-states/state-function-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
