JavaScript Practice Questions And Answer

Problem: Write a Program to take input from user and find the length of a string,position.
Solution:
            <html>
             <head>
              <script>
                function demo1()
                {
                  var str1 = document.getElementById("input1").value
                  var str2 = document.getElementById("input2").value
                   if(str1 == str2)
                 {
                    document.write("both strings same")
                 }
                   else
                   {
                    document.write("Not same")
                   }  
            }
        </script>
    </head>
    <body>
        <input type= "text" id="input1" placeholder="enter data"/>
        <br>
        <input type= "text" id="input2" placeholder="enter data"/>
        <br><br>
        <input type="button" value="Check Equal" onclick="demo1()"/><br>
    </body>
</html>
          

Contact Us

Our Address

Plot No. 64, PU-4, Scheme 54, Behind C21 Mall near Hotel Holiday , AB Road, Indore Pin-code:452001

Email Us

contact@codebetter.in

Call Us

+91 88230 75444, +91 99939 28766

Loading
Your message has been sent. Thank you!