# Global.get('')||0 inconsistent resutls (Function node)

**URL:** https://discourse.nodered.org/t/global-get-0-inconsistent-resutls-function-node/68457
**Category:** General
**Created:** [1 October 2022 15:21 UTC](https://discourse.nodered.org/t/global-get-0-inconsistent-resutls-function-node/68457 "2022-10-01T15:21:24Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![edterbak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edterbak/32/60017_2.png) [@edterbak](https://discourse.nodered.org/u/edterbak)
#### Post date: [1 October 2022 15:21 UTC](https://discourse.nodered.org/t/global-get-0-inconsistent-resutls-function-node/68457/1 "2022-10-01T15:21:24Z")

</div>

Hello everyone,

Im using Function node a lot.

But I am seeing irratic behaviour of node red. Atleast thats how I percieve it. Might be due to a lack of understading 🙂

```auto
var nr_corr = global.get('NightReduction_current_value',"file");
msg.payload = nr_corr;
return msg;

```

Debug node after and inject node in front shows this produces value 0. As expected. It is also the stored value.

If I want to have a default value of 10 when the variable is undefined, I was thinking that adding "||10 " would be enough. like below

```auto
var nr_corr = global.get('NightReduction_current_value',"file")||10;
msg.payload = nr_corr;
return msg;

```

I expect it to produce 0 now. Because the value is known as shown in the first example.  
But the debug node shows value 10 instead.

Is there something I am missing?  
This behaviour is sometimes there, sometimes not.

Im currently using NodeRed version 3.0.2

many thanks in advance 😄

---

_[View the full topic](https://discourse.nodered.org/t/global-get-0-inconsistent-resutls-function-node/68457)._
