# Need help with a simple function

**URL:** <https://discourse.nodered.org/t/need-help-with-a-simple-function/3708>\
**Category:** General\
**Created:** [5 October 2018 08:21 UTC](https://discourse.nodered.org/t/need-help-with-a-simple-function/3708 "2018-10-05T08:21:54Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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:** [5 October 2018 08:46 UTC](https://discourse.nodered.org/t/need-help-with-a-simple-function/3708/5 "2018-10-05T08:46:32Z")

</div>

See [this](https://discourse.nodered.org/t/and-confusion/3642/2?u=knolleary) recent thread about the differences between `==` and `===`.

It all depends on the precise value and type of `msg.payload` you are testing. If it is a proper boolean value (`false`) rather than a String (`"false"`) then you will be able to do:

```auto
if(!msg.payload){
    msg.payload="Online"
}
else
{
    msg.payload="Offline"
}
return msg;

```

But it does all hinge on what the incoming `msg.payload` looks like - pass it to a Debug node and share the output.

---

_[View the full topic](https://discourse.nodered.org/t/need-help-with-a-simple-function/3708)._
