# How to store Name of the Function to the variable

**URL:** <https://discourse.nodered.org/t/how-to-store-name-of-the-function-to-the-variable/57421>\
**Category:** General\
**Created:** [28 January 2022 19:44 UTC](https://discourse.nodered.org/t/how-to-store-name-of-the-function-to-the-variable/57421 "2022-01-28T19:44:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![demokedes](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/demokedes/32/19082_2.png) [@demokedes](https://discourse.nodered.org/u/demokedes)\
**Post date:** [28 January 2022 19:44 UTC](https://discourse.nodered.org/t/how-to-store-name-of-the-function-to-the-variable/57421/1 "2022-01-28T19:44:46Z")

</div>

Dear All,  
I have Function with its name. How to get name of the function into the variable?  
In pasted example, how can I get "Rok" into the variable in that particular function?  
 ![Screenshot 2022-01-28 204420](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/c/fcc96797cc82f8037b27a27dca454387ac9ec9ea.jpeg)

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [28 January 2022 19:47 UTC](https://discourse.nodered.org/t/how-to-store-name-of-the-function-to-the-variable/57421/2 "2022-01-28T19:47:20Z")

</div>

With `node.name`

Example Flow :

```auto
[{"id":"e88d8d33f7ce918a","type":"function","z":"54efb553244c241f","name":"nodeName","func":"msg.payload = node.name\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":550,"y":940,"wires":[["78848bda70e155d9"]]},{"id":"18e37e3663320978","type":"inject","z":"54efb553244c241f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":380,"y":940,"wires":[["e88d8d33f7ce918a"]]},{"id":"78848bda70e155d9","type":"debug","z":"54efb553244c241f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":730,"y":940,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [28 January 2022 19:47 UTC](https://discourse.nodered.org/t/how-to-store-name-of-the-function-to-the-variable/57421/3 "2022-01-28T19:47:35Z")

</div>

`let var_name = node.name;`

or if you want to see what else the node object holds. look at  
`let var_name = node;`

---

<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:** [28 January 2022 19:53 UTC](https://discourse.nodered.org/t/how-to-store-name-of-the-function-to-the-variable/57421/4 "2022-01-28T19:53:56Z")

</div>

This becomes immediately obvious if you use the Monaco editor...

![chrome_X9F5N8p6kz](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/0/a0621cd766214444045cde5829fb5da1f9b5abbd.gif)

---

<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:** [29 March 2022 19:54 UTC](https://discourse.nodered.org/t/how-to-store-name-of-the-function-to-the-variable/57421/5 "2022-03-29T19:54:34Z")

</div>

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