JavaScript Tutorial

JavaScript was initially name as "LiveScript". But Java was very popular at that time, so it was decided to name as "JavaScript". It is a fully independent language with its own specification called ECMAScript, and now it has no relation to Java.

The program written in this language are called scripts. They can be written in a HTML web page's and run automatically as the page loads. Scripts are executed as plain text. They don't need compilation to run.

JavaScript is a client side scripting language used to create web pages dynamic and interactive. Today, JavaScript can execute not only in the browser, but also on the server, or on any device that has a special program 'JavaScript engine'. The browser has an embedded engine sometimes called a "JavaScript virtual machine".

Advantages of JavaScript:

  1. Full integration with HTML/CSS.
  2. JavaScript can be used to create webpages, mobile applications, etc.
  3. Supported by all major browsers and enabled by default.

Easy and step-by-step JavaScript tutorials with solved examples. This Tutorials is for beginners and experts who want to revise JavaScript.

In this tutorial, we are using Visual Studio Code, IDE

DHTML Using HTML Language

What can in-browser JavaScript do?

In-browser JavaScript is able to:

  1. Add new HTML to the page, change the existing content, modify styles.
  2. Handle user actions, mouse clicks, movements, key presses.
  3. Get and set cookies, ask questions to the visitor, show messages.
  4. Remember the data on the client-side (“local storage”).

What CAN'T in-browser JavaScript do?

JavaScript's abilities in the browser are limited to protect the user's safety, thus browser provides restrictions

Examples of such restrictions are:

  1. JavaScript on a webpage may not read/write arbitrary files on the hard disk. It has no direct access to OS functions.
  2. Different tabs/windows generally do not know about each other.

Prerequisite

Prerequisite for JavaScript is Basic knowledge of HTML and CSS.