Programming Tips - Is there a robust way to check a string for being empty?

Date: 2014nov16 Updated: 2017sep25 Language: javaScript Q. Is there a robust way to check a string for being empty? A. These functions handle undefined, null, zero length and ignore leading and trailing space
function isSpace(s) { if (s === undefined || s == null) return true; if (typeof s != 'string') s = s.toString(s); if (s.length == 0) return true; return s.match(/^\s*$/); } function hasContent(s) { return ! isSpace(s); }