# Syntax for deprecated context.myvar instead of context.set()

**URL:** <https://discourse.nodered.org/t/syntax-for-deprecated-context-myvar-instead-of-context-set/24523>\
**Category:** General\
**Created:** [9 April 2020 13:46 UTC](https://discourse.nodered.org/t/syntax-for-deprecated-context-myvar-instead-of-context-set/24523 "2020-04-09T13:46:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)\
**Post date:** [9 April 2020 13:46 UTC](https://discourse.nodered.org/t/syntax-for-deprecated-context-myvar-instead-of-context-set/24523/1 "2020-04-09T13:46:49Z")

</div>

I don't know if im having an especially slow day but I cant figure out the syntax for the "deprecated" method to use and set context variables that was used before context.get().  
Why do I need it? Im running into the circular error because i need to save an array of several setTimeouts to a context variable.  
I found in another thread that the recommended way would be to utilize the deprecated syntax but I never used it and I adont seam to be able to figure out bymyself what it is. ☹  
So can someone give me an example please.

stay healthy Johannes

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [9 April 2020 13:52 UTC](https://discourse.nodered.org/t/syntax-for-deprecated-context-myvar-instead-of-context-set/24523/2 "2020-04-09T13:52:13Z")

</div>

You can just set `context.myvar = "whatever"`

That sets the `myvar` property of the `context` object. That is _not_ the same as doing `context.set("myvar", "whatever")` - which stores the property inside the context store itself.

So having done `context.myvar = "xyz"` you can only access it again as `context.myvar`. You cannot use `context.get("myvar")` or access it with a Change node etc.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [23 April 2020 13:54 UTC](https://discourse.nodered.org/t/syntax-for-deprecated-context-myvar-instead-of-context-set/24523/4 "2020-04-23T13:54:02Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
