screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> </head> <body> <div id="app"> <h1>Javascript Check String is Empty or not</h1> <button onclick="checkString()">Check String</button> <p id="output"></p> </div> <script> const string = ' '; function isEmpty(str) { return !str || str.trim().length === 0; } function checkString() { var result = isEmpty(string); if (result) { document.getElementById("output").innerHTML = "String is Empty"; } else { document.getElementById("output").innerHTML = "Sting has some Value"; } } </script> </body> </html>