Question: how to check string is empty in js?
Answer: <script> if(str === ""){ // string is empty, do something. } // Some test cases. alert(2 === ""); // Outputs: flase. alert(0 === "") // Outputs: false. alert("" === "") // Outputs: true.