is var is not blank then display value in javascript

JavaScript
if(data !== null && data !== '') {
   // do something
}
Source

Also in JavaScript: