Tuesday 27 March 2018

Introduction To JavaScript

JavaScript is a scripting language that is lightweight, open source and cross-platform.
JavaScript is a case-sensitive language.
It is object oriented language because it supports OOPS(object oriented programming system).
Extension of JavaScript is .js

Uses
JavaScript is used to create interactive websites.
It is used for Client-side validation.
It is used for Displaying popup windows and dialog boxes (like alert dialog box, confirm dialog box and prompt dialog box)
Example:
<script>  
document.write("Welcome to LearningPoint92");  
    </script>
      
       OR
 
   <script type="text/javascript">  
   document.write("Welcome to LearningPoint92");  
   </script> 
    
     Note:
Script : We have to write all data in Script tag when we are using JavaScript
text/javascript: It is the content type that provides information to the browser about the data.
document.write() function is used to display the output .

Where to put JavaScript code
1.     Between the body tag of html
2.     Between the head tag of html
3.   external javaScript
Between the body tag of html
<html> 
<body> 
<script type="text/javascript"> 
 alert("Hello LearningPoint92"); 
</script> 
</body> 
</html> 

Between the head tag of html
<html>
<head>  
  <script type="text/javascript">  
   function display(){  
   alert("Hello LearningPoint92"); 
   }  
  </script>  
  </head>  
  <body>  
  <p>Heyy </p>  
  <form>  
  <input type="button" value="click" onclick="display()"/>  
  </form>  
  </body>  
  </html>  

External JavaScript:
Here we have to create separate JavaScript file (demo.js)
Index.html
   <html>  
  <head>  
  <script type="text/javascript" src="demo.js"></script>  
  </head>  
   <body>  
  <p>Welcome to LearningPoint92 </p>  
  <form>  
  <input type="button" value="click" onclick="display()"/>  
  </form>  
  </body>  
  </html>  

  demo.js
  function display(){  
  alert("Hello users");  
    }  

Comments
Comments are not executed by compiler.
Comments are used to highlight the statements.
You can explain code, variable, method, object, property or class but not execute the code.
There are two types of comments in PHP.
·                     Single Line comment (//)
·                     Multi Line comment (/ ..... /).


1 comment:

  1. Python is an open-source, high level, interpreted programming language which offers great opportunities for object-oriented programming. Choosing a python training program from Red Prism Group, which is best training institute for python in noida.

    ReplyDelete

apply function in R

1) apply function: It takes 3 arguments matrix,margin and function.. Example: m<-matrix(c(1,2,3,4),nrow=2,ncol=2) m #1 indicates it is ap...