# How to create enum global

**URL:** <https://discourse.nodered.org/t/how-to-create-enum-global/33186>\
**Category:** General\
**Created:** [22 September 2020 15:53 UTC](https://discourse.nodered.org/t/how-to-create-enum-global/33186 "2020-09-22T15:53:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![minhhn0205](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/minhhn0205/32/29062_2.png) [@minhhn0205](https://discourse.nodered.org/u/minhhn0205)\
**Post date:** [22 September 2020 15:53 UTC](https://discourse.nodered.org/t/how-to-create-enum-global/33186/1 "2020-09-22T15:53:20Z")

</div>

Hi,  
I am new to node-Red so I do not know if there is an **enum** in Node-Red?  
If has, can I set it to **enum global** so that multiple nodes can use it?  
or how does Node-Red use enum type, please suggest for me!  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [22 September 2020 17:21 UTC](https://discourse.nodered.org/t/how-to-create-enum-global/33186/2 "2020-09-22T17:21:19Z")

</div>

This is not a Node-RED question really, rather a JavaScript one.

JavaScript doesn't really have ENUM's mainly because it isn't a typed language. But also because you can so easily create objects with properties.

If you really want ENUM's, you could need to switch to Typescript but that means that you need to compile all of your code to JavaScript before you can use it.

Otherwise, the JS way would be to build a reference object variable containing either a list of valid entries or an Object of key'd entries depending on need.

---

<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:** [6 October 2020 17:21 UTC](https://discourse.nodered.org/t/how-to-create-enum-global/33186/3 "2020-10-06T17:21:20Z")

</div>

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