# How to clear context?

**URL:** https://discourse.nodered.org/t/how-to-clear-context/80880
**Category:** Dashboard
**Created:** [29 August 2023 09:06 UTC](https://discourse.nodered.org/t/how-to-clear-context/80880 "2023-08-29T09:06:23Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [29 August 2023 09:37 UTC](https://discourse.nodered.org/t/how-to-clear-context/80880/2 "2023-08-29T09:37:22Z")

</div>

> [@michael1](#):
>
> Is there a way to clear entire contex

Not out of the box. You would need to get the keys and iterate them, setting each one to `undefined`

```auto
const keys = flow.keys()

for (let index = 0; index < keys.length; index++) {
    const key = keys[index];
    flow.set(key, undefined)
}

```

![chrome_vAlMAdN2mR](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/b/dbc56abe9483a6859bdc8b8397afa9ab70da441d.gif)

* * *

### BETTER MANAGEMENT of context:

Store all your context variables in a single object, then you can just delete that 1 single object.

---

_[View the full topic](https://discourse.nodered.org/t/how-to-clear-context/80880)._
