# Using simpler globar variables \`RED.f.myVar\`

**URL:** <https://discourse.nodered.org/t/using-simpler-globar-variables-red-f-myvar/101179>\
**Category:** Core Development\
**Tags:** suggestion\
**Created:** [3 June 2026 00:40 UTC](https://discourse.nodered.org/t/using-simpler-globar-variables-red-f-myvar/101179 "2026-06-03T00:40:32Z")\
**Posts on this page:** 2\
**Page:** 3

<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:** [7 June 2026 14:50 UTC](https://discourse.nodered.org/t/using-simpler-globar-variables-red-f-myvar/101179/42 "2026-06-07T14:50:50Z")

</div>

> [@PizzaProgram](#):
>
> Even if the sidebar shows "map" as type, in function node the `instanceof Map` does **not** get `true` and the `typeof` is `Object`.

As Steve pointed out, `typeof` is not going to work due to the use of the node.js VM for the function node. Here is the code I was using to test the types:

```javascript

const roundTrip = flow.get('complexObj')
// node.warn(JSON.serialize(Object.keys(roundTrip)))

node.warn(`bigint > max safe integer?: ${roundTrip.specials.bigint > Number.MAX_SAFE_INTEGER}`)
// Have to use constructor names not typeof because we are in a VM?
node.warn(`constructor of map?: ${roundTrip.specials.map.constructor.name}`)
node.warn(`constructor of set?: ${roundTrip.specials.set.constructor.name}`)
node.warn(`constructor of error?: ${roundTrip.specials.error.constructor.name}`)
node.warn(`constructor of arrayBuffer?: ${roundTrip.specials.arrayBuffer.constructor.name}`)
node.warn(`constructor of weakmap?: ${roundTrip.specials.weakmap?.constructor?.name}`)

return { payload: roundTrip }

```

The constructor name for Map is `Map` 😃

Node.js does also have a `types` function in its `node:utils` library which should identify Map's correctly. However, again, the VM gets in the way. Just to note that the saferSerialize function from uibuilder does use the utils library and it is working fine in function nodes because the function actually comes from the uibuilder plugin via the RED.util object.

---

<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 August 2026 14:51 UTC](https://discourse.nodered.org/t/using-simpler-globar-variables-red-f-myvar/101179/43 "2026-08-06T14:51:18Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/using-simpler-globar-variables-red-f-myvar/101179.md?page=2)
