Source Code
JavaScript 19 Apr 2023

JavaScript Program to print Hello World!

                    
  <!DOCTYPE html>
  <html>
   <head>
     <title>JavaScript Programming.</title>
   </head>
   <body>
     <h1 >JavaScript Program to print Hello World!</h1>
     <h2 id="demo"></h2> 

     <script>
     document.getElementById("demo").innerHTML = "Hello JavaScript";
     </script> 

   </body>
  </html>	
                    
                    

Learn More
JavaScript 19 Apr 2023

JavaScript Program to Add Two Numbers

  
    <!DOCTYPE html>
    <html>
     <head>
       <title>JavaScript Programming.</title>
     </head>
     <body>
       <h1 >JavaScript Program to Add Two Numbers !</h1>
       <h2 id="demo"></h2> 
  
       <script>
       let a, b, sum;
       a = 10;
       b = 20;
       sum = a + b;
       document.getElementById("demo").innerHTML = 'Sum of ' + a + ' and ' + b + ' is ' + sum ;
       </script> 
  
     </body>
    </html>

  

Learn More
JavaScript 19 Apr 2023

JavaScript Program to Check Odd or Even

    
        <!DOCTYPE html>
        <html>
         <head>
           <title>JavaScript Programming.</title>
         </head>
         <body>
           <h1 >JavaScript Program to Check Odd or Even !</h1>
           <h2 id="demo"></h2> 
      
           <script>
           let num;
           num = 14;
           x = num % 2 == 0 ? "Even Number" : "Odd Number";
           document.getElementById("demo").innerHTML =  x;
           </script> 
      
         </body>
        </html>
      
    
  

Learn More