Prevent Nullpointer Exception In IBM BAW JavaScript
While we are dealing with business objects in BAW javascript, we may need to do some comparation between values.
If we are dealing with complex business object and try to compare it in deeper levels it may get a Nullpointer exeption.
Lets say that we have a business object like below.

And we would like to check if address.number is X or not.

If we do comparison like above we get “Cannot read property number from null“ because Address object is null.
We have 2 options to handle this.
Classic if else statements

NVL function equivalent in JavaScript

tw.local.user || {} means
(tw.local.user != null) ? tw.local.user : {}
If it is null basicly it returns new object.