How to check if a value is not null and not empty string in JavaScript

1 Answer

0 votes
const val = 'javascript';
 
if (val !== null && val !== '') {
   console.log("not null and not empty")
} 
 
 
 
 
/*
run:
 
not null and not empty
 
*/

 



answered Feb 7, 2022 by avibootz
...