I have this code for my check method:
static emptyOrWhiteSpaceString(obj: string, paramName: string) {
if (obj === null || obj === '' || obj === ' ') {
throw new ServiceException(`${paramName} name is empty.`);
}
}
and I got this suggestion from a reviewer in my pull request:
if (!obj || !obj.trim())
I understand what he wants, but I don't understand the way he is saying it. Please help, how to fix this code according to this answer?

trim()removes the whitespace from both ends of a string, effectively makingobj === ' 'no longer needed. Not sure what the screenshot is, but it looks like it is returning booleans, which would probably be better to return false or true rather than throw an Exception.