check variable is string and not empty js code example
Example 1: js if string not empty
if (!str.length) { ...
Example 2: javascript check if variable is empty
if( value ) {
//
}
/**
* This will evaluate to true if value is not:
* null
* undefined
* NaN
* empty string ("")
* 0
* false
*/