xxxxxxxxxx
const str: string = ""; // the string to check
if (str.length === 0) {
console.log("String is empty");
} else {
console.log("String is not empty");
}
xxxxxxxxxx
if(typeof propertyValue!='undefined' && propertyValue){
//execute code here
}
xxxxxxxxxx
var string = "not empty";
if(string == ""){
console.log("Please Add");
}
else{
console.log("You can pass"); // console will log this msg because our string is not empty
}
xxxxxxxxxx
if (strValue) {
// strValue was non-empty string, true, 42, Infinity, [], ...
}