SyntaxFix
Write A Post
Hire A Developer
Questions
I often test for truthy value and also for empty spaces in the string:
if(!(!data || data.trim().length === 0)) { // do something here }
If you have a string consisting of one or more empty spaces it will evaluate to true.