I am checking a value in my controller.Here is my code.
var contents = atob(response.documents);
// I checked the value in contents . it is displaying ""
if(contents === ""){
// no contents
}
the if condition is retuning false, when the contents has "" and when the contents has data. How to check condition?
Good plain Javascript.
if(!contents){
}
How about contents.trim().length === 0
?
Empty string in Javascript is falsey you can use:
if(contents){
//has content
}else{
//no content
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With