Ask Reuben 87 - NULL (Test for Success)

Started by Reuben B., August 17, 2021, 04:34:28 AM

Previous topic - Next topic

Reuben B.

I was looking at a support case recently where the value returned from a function was NULL when it was expected to contain a value.  The puzzling thing was the change that led to the function returning NULL had occurred a few years ago and we were wondering why it had not been detected earlier.  The reason it had not been detected was that a test to check the value did not consider the possibility that the value could be NULL.

In this article I show some strategies for coding expressions so that if a value is unexpectedly NULL your code will detect that the value is not as you expect, and take the right path through an IF ELSE.

Read more at https://4js.com/ask-reuben/ig-87/
Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero