Might be better to check if titleText is not `null` or `undefined` and has length:
``javascript
if ( titleText !== null && titleText !== undefined && titleText.length ) { ... }
```