Check if a variable is empty using length property. #
example, we will use the length property to check if a variable is empty.
<script>
const myVar="";
if(myVar.length === 0){
console.log("Variable is empty.");
}else{
console.log("Variable is not empty.")
}
</script>
0 Comments