# JavaScript Examples - Using Args

Check below how to call an argument:

The first example (Code tab) depicts how you can enable the use of args by using ``event.args.<ARG_CREATED>`` . The second example (Args tab) represents the use of JSON parameters by internal code functions.

## Code tab

```js
  async function handleRequest(request, v) {
          return new Response(v, {
              headers: new Headers([
                  ["X-Custom-Header", "something defined on JS"],
              ]),
              status: 200,
          });
      }
      addEventListener("fetch", (event) => {
          event.respondWith(handleRequest(event.request, event.args.value));
      });
```

---

## Args tab

```js
{
    "value": "hello_world"
}
```

## How it works

Arguments are key-value pairs you define alongside the function and read at runtime through `event.args`. In the Code tab, the `fetch` handler passes `event.args.value` into `handleRequest`, which returns it in the body of a new `Response` along with a custom header set via `new Headers([...])` and an explicit `status: 200`. The Args tab shows the matching JSON object, where the `value` key supplies the data the function reads. This lets you reuse the same code across instances while changing behavior purely through configuration, with no code edits or redeploy.

## Related resources

- [JavaScript examples](/en/documentation/devtools/javascript-examples/)
- [Runtime APIs](/en/documentation/products/applications/functions/runtime-apis/javascript/fetch-event/)