UI - Text Node with a function node

Hello there I am very new to node-red and programming in general i was wondering if there was a way to write a function before a UI - Text Node that would display the message if there was a reading but to not display anything if the answer to the function came back as undefined, many thanks

You can do it with a switch node, only allow the message through if it contains something.

You could do the same with an If statement in a function node. If you google “javascript if” you should find many tutorials online.

But it would also be worth reading one about javascript arrays and objects, which a fundamental to Node-RED (the w3schools one often gets recommended)

Okay I'll have a read up on those and look into switch nodes thanks for the help