# Test for undefined in switch node?

**URL:** <https://discourse.nodered.org/t/test-for-undefined-in-switch-node/29271>\
**Category:** General\
**Created:** [1 July 2020 01:10 UTC](https://discourse.nodered.org/t/test-for-undefined-in-switch-node/29271 "2020-07-01T01:10:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [1 July 2020 01:10 UTC](https://discourse.nodered.org/t/test-for-undefined-in-switch-node/29271/1 "2020-07-01T01:10:05Z")

</div>

I have seen references to using a switch and testing for 'is not null' as a way to determine if a variable is not undefined. Is this is not strictly correct. Is there a reason the switch node has no test for undefined or not undefined then?

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [1 July 2020 01:41 UTC](https://discourse.nodered.org/t/test-for-undefined-in-switch-node/29271/2 "2020-07-01T01:41:19Z")

</div>

The switch node has an option to test `undefined`

![a-1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/5/c591f34451bd06add8647ea1b5ce42b25339736e.png)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 July 2020 01:41 UTC](https://discourse.nodered.org/t/test-for-undefined-in-switch-node/29271/3 "2020-07-01T01:41:58Z")

</div>

Thanks. You saved me that @Andrei . I was replying and you got in first.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [1 July 2020 03:47 UTC](https://discourse.nodered.org/t/test-for-undefined-in-switch-node/29271/4 "2020-07-01T03:47:20Z")

</div>

Nice, thank you very much.

---

<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:** [15 July 2020 03:47 UTC](https://discourse.nodered.org/t/test-for-undefined-in-switch-node/29271/5 "2020-07-15T03:47:35Z")

</div>

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