All IT Courses 50% Off
JAVA Tutorials

What is JavaScript?

JavaScript is both a client-side scripting language as well as a server-side scripting language, which is used for the enhancement of user interaction with the webpage. It makes the web page more interactive, dynamic, and user friendly. It is widely used in the development of mobile applications and games. Initially, it was named LiveScript, but later it is changed to JavaScript by Netscape.

To run JavaScript code, the browser is responsible. JavaScript now works on all the browsers, whether it is Internet Explorer, Mozilla Firefox, Chrome, etc. JavaScript also works on all types of operating systems, including Linux, Windows, or Mac. For example, JavaScript can be used to check whether the user has entered a valid email id before submitting it to the server.

We need to place the JavaScript code within <script> tags (<script> and </script>). This will help the browser to distinguish between the JavaScript code and the rest of the code.

Syntax:

<script type="text/javascript">
A sample JavaScript program is given below:
<html>
<head>
<title>My First JavaScript code!!!</title>
<script type="text/javascript">
alert("Hello World!");
</script>
</head>
<body>
</body>
</html>

While using HTML5 you do not need to specify “text/javascript”. This simple code will also work:

All IT Courses 50% Off
<html>
<head>
<title>My First JavaScript code!!!</title>
<script>
alert("Hello World!");
</script>
</head>
<body>
</body>
</html>

Features of JavaScript:

Some of the main features of JavaScript are:

  1. All the web browsers support JavaScript.
  2. It is a structured programming language as it follows the syntax and structure of the C Programming language.
  3. It is a lightweight and interpreted language.
  4. It is also a case sensitive language.
  5. It is supported by all the operating systems.
  6. It provides user-friendly control.
  7. It provides full integration with HTML/CSS.
  8. It provides validation to the forms created in HTML.
  9. The compiler is not needed to execute the code.
  10. It can also handle date and time.

Applications of JavaScript:

JavaScript is used for both Front ends as well as back end.

  1. Client-Side Validation: It is used to verify the user input before submitting it to the server.
  2. Manipulating HTML Pages: You can easily delete and add HTML tags using JavaScript and can modify it to change the look and feel of the web page.
  3. User Notifications: It is used to raise the dynamic pop-ups on the webpage to give notification to the user.
  4. Back-end Data Loading: It also uses Ajax to load back end data while processing.
  5. Presentations: Presentations can be created using JavaScript to provide a great look and feel to the website.
  6. Server Applications: This is also used to develop Server applications, including Web server.

Advantages of JavaScript:

  1. Less Server Interaction: Input can be validated before submitting the page to the server, which reduces traffic and load to the server.
  2. Immediate Feedback to the Users: User does not have to wait for the web page to reload to check if the entered inputs are valid or not.
  3. Increased Interactivity: Interfaces can be created, including mouse actions and keyboard events.
  4. Richer Interfaces: With the help of JavaScript, items such as drag and drop and sliders can be added, which provides a rich interface.

Disadvantages of JavaScript:

  1. JavaScript does not allow the reading and writing of files.
  2. JavaScript cannot be used for network applications.
  3. It does not have the capability of handling multithreading and multiprocessor jobs.
Facebook Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Articles

Back to top button