Breaking News

JavaScript


            
JavaScript -Technotoken

what is JavaScript?

JavaScript is a scripting or programming language that allows you to implement complex features on web pages which one must learn in order to excel in web development. Every time a web page does more than just sit there and display static information for you to look at you can bet that JavaScript is probably involved. This language is used to make webpages more interactive and to provide timely content updates, interactive maps, animated 2D/3D graphics, scrolling video jukeboxes, etc. also the majority of websites today enjoy it and all the modern web browsers support it without any need for plug-ins by using a built-in JavaScript engine.

Syntax

the syntax of JavaScript is as follows :

Var a=5;
Console.log(a);   / / 5
Console.log(A);   / /  throws   a 
ReferenceError:   A is not defined

Example code

  1. <html>  
  2. <head>  
  3. <script type="text/javascript">  
  4. function msg(){  
  5.  alert("Hello Javatpoint");  
  6. }  
  7. </script>  
  8. </head>  
  9. <body>  
  10. <p>Welcome to JavaScript</p>  
  11. <form>  
  12. <input type="button" value="click" onclick="msg()"/>  
  13. </form>  
  14. </body>  
  15. </html>  

Explanation

in the example above an statement which is :
    1. <script type="text/javascript">  
    2. function msg(){  
    3.  alert("Hello Javatpoint");  
    4. }  
    5. </script> 
  1. This statement tells the compiler that we are using Javascript and it is shown by using "text/Javascript" and now the compiler know that we are going to use Javascript in our program so it is ready now and now we write the instructions in between two braces under function msg() and the message which we have to display should be specified that how you want to display it so we wrote alert before the message of our by which compiler prints the statement which is ( " hello javatpoint " ) and now proceeding to the body we have a paragraph in between two p tags ( <p> ). If you are new to tags then go and check out the HTML post there we have explained it in a much broader way. Now returning here we have specified the type of input the user will provide us which is by clicking on the button so we have set all the parameters of that button i.e type, on click, and value, and by clicking on this button the user will get the alert message of welcome to Java script. 



So this is it guys if you want us to write more on this topic or have any particular query regarding this post you can always comment or feel free to mail us at our official mail also follow us on Instagram and Facebook to receive Latest Updates first.

PEACE!!!

No comments

If you have any doubts, please let us Know.