Try executing this in your browser console or in a node.js repl.
var string = ' ';
string ? true : false;
//-> true
string = '';
string ? true : false;
//-> false
Therefore, a simple branching construct will suffice for the test.
if(string) {
// string is not empty
}