# Expressions

Expressions are strings or HTML markup whose contents can be replaced with the values of an object when evaluated.

## String

Use variables enclosed in brackets `{ }` in string expressions to represent the properties of an object.  The properties will be replaced with the values of the properties within the object when evaluated. &#x20;

Use the string function extension `eval` to evaluate an expression using an object passed into the function.

```javascript
const data = {company: "Acme", employee: "Fred" };

const str = "{employee} works for {company}".eval(data);

// Fred works at Acme
```

## HTML

These same expressions can be set up inside HTML markup and evaluated using the `wire.ui.eval` method.

The first parameter to this method is the selector for the DOM element container for the markup.  The second is the data to be used to evaluate expressions in the markup.

Consider the markup below.

```html
<div id="exp">
    <span>{employee} works for</span><span>{company}</span>
</div>
```

Use the `wire.ui.eval` method to evaluate the containing element `exp` using the `data` object from the previous example.

```javascript
wire.ui.eval("#exp", data);
```


---

# 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.wirebootstrap.com/wirebootstrap/utilities/expressions.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.
