Recent Posts

What Is JavaScript? and How To Declare Variables In JavaScript | JavaScript Tutorial | infodpsoft

JavaScript is Compiled Programming Language Of  Html. You Can Place The <script> tag in <head> tag.

javascript editor,javascript introduction,javascript syntax,javascript examples,learn javascript free,earn javascript step by step pdf,javascript operator

Syntax
  1. <script language = "javascript" type = "text/javascript"> 
  2. //Code
  3. </script> 
1) Program
  1. <html>
  2. <body>   
  3. <script language = "javascript" type = "text/javascript">
  4. document.write("Hello World") 
  5.        </script>      
  6. </body>
  7. </html>
OutPut 
Hello World

How To Declare Variables. 

Must be declared Variables the var keyword.

Syntax

  1. <head>
  2.       <script type="text/javascript">
  3.             var <var_name>;
  4.       </script>
  5.    </head>

2) Program

  1. <html>
  2.    <head>
  3.       <script type="text/javascript">
  4.          var myvar="Hello Infodpsoft";
  5.          document.write(myvar);
  6.       </script>
  7.    </head>
  8. <body>
  9. </body>
  10. </html>

OutPut

Hello Infodpsoft


Simple Addition Program.

3) Program

  1. <html>
  2.    <head>
  3.       <script type="text/javascript">
  4.          var a=10;
  5.          var b=15;
  6.          var c =a+b;
  7.          document.write(c);
  8.       </script>
  9.    </head>
  10. <body>
  11. </body>
  12. </html>

OutPut

25

1 comment:

Powered by Blogger.