Answers for "how to check if a variable not a empty string"

1

check if string is empty

let str1 = "Hello world!";
let str2 = "";
let str3 = 4;
console.log(str1.length === 0)
console.log(str2.length === 0)
console.log(str3.length === 0)

false
true
false
Posted by: Guest on December-15-2021

Code answers related to "how to check if a variable not a empty string"

Browse Popular Code Answers by Language