JavaScript Introduction

JavaScript Introduction


JavaScript Introduction
What is JavaScript: JavaScript is a client-side scripting language, i.e., it executes on the user's machine rather than the server hosting the website. It creates interactive web pages and adds dynamic effects to them. JavaScript is an object-oriented language like C++ and Java. However, it is not related to the Java language in any way. It is also designed for creating network-centric applications.
The biggest feature of JavaScript is its ability to react to users' actions, like button click, scrolling, and typing. It enabled designers to convert their ideas into practicality, which was not possible before.
A good designer needs to know the basics first, only then they can fully explore the capabilities of JavaScript. It is considered that JS is the most powerful language at present. So, in this tutorial, we will cover all the basics and some advanced topics.
Why uses JavaScipt
  • JavaScript is used to make web pages interactive
  • JavaScript insert dynamic text into HTML (ex: user name)
  • JavaScript react to events (ex: page load user click)
  • JavaScript get information about a user's computer (ex: browser type)
  • JavaScript performs calculations on the user's computer (ex: form validation)
  • JavaScript is a web standard (but not supported identically by all browsers)
  • JavaScript NOT related to Java other than by name and some syntactic similarities 
The Syntax of JavaScript is as follows:
 
Including JavaScript in HTML
Two ways to add JavaScript to Web pages
  • Use the tag
  • Include the script in an external file
Initially, we will only use the tag
Displaying text
 
document.write()                          
Example: Print Hello World! is as follow:
Output
Common Uses of JavaScript
  • Form validation
  • Page embellishments and special effects
  • Navigation systems
  • Basic math calculations
  • Dynamic content manipulation
  • Sample applications