*** title: Use TypeScript in an Evaluate block topictype: tutorial updated: 2025-09-09T00:00:00.000Z slug: docs/postman-flows/cookbook/use-typescript-in-evaluate max-toc-depth: 2 ---------------- You can use TypeScript to process and manipulate data in [**Evaluate**](/docs/postman-flows/reference/blocks/evaluate/), [**Condition**](/docs/postman-flows/reference/blocks/condition/), and [**If**](/docs/postman-flows/reference/blocks/if/) blocks in your flows. For example, you might use TypeScript to format a timestamp, check a response for errors, or select an item from a list. ## Recipe The following recipe describes how to use TypeScript with an **Evaluate** block to select a random item from a list: 1. Create a flow and add an **HTTP Request** block. For this example, send a GET request to `https://openlibrary.org/subjects/love.json?limit=5`. This gets a list of five book titles. 2. Connect an **Evaluate** block to the **HTTP Request** block's **Success** port. 3. In the **Evaluate** block, name the variable `items` and set it to `body.works`. 4. Enter the following TypeScript in the **Evaluate** block to select a random title from the response: ```js items[Math.floor(Math.random() * items.length)].title ``` 5. Run the flow and click the **Evaluate** block's **Result** output port to see the selected title. ## Try it out To see this recipe's completed flow, check out [Cookbook: Use TypeScript to select a random item from a list](https://www.postman.com/postman/flows-snippets/flow/68befc03566b1a00131c230f/). You can also [clone this flow](/docs/postman-flows/build-flows/create/clone-flows/) to your workspace to experiment with it.