JavaScript Tutorial

Javascript

JavaScript was initially named 'LiveScript'. But the Java programming language was very popular at that time, so it was decided to name it 'JavaScript'. It is a fully independent language with its own specifications called ECMAScript, and it has no relation to the Java language.

The programs written in this language are called scripts. It can be written in an HTML file and run automatically as the page loads. Scripts are executed as plain text, they don't need any compilation to run.

Today, JavaScript can execute not only in the browser but also on the server or on any device that has a special software 'JavaScript engine'. The browser has an integrated engine known as a "JavaScript virtual machine."

Advantages of JavaScript:

  1. Full integration with HTML/CSS.
  2. Supported by all major browsers and enabled by default.
  3. Nowadays, JavaScript is used to build any type of application: web applications (frontend & backend), mobile applications, desktop applications, machine learning, etc.
DHTML Using HTML Language

What can in-browser JavaScript do?

In-browser JavaScript is able to do many tasks, few are listed below:

  1. Add new HTML to the page, change the existing content, and modify styles.
  2. Handle user actions, mouse clicks, movements, and key presses.
  3. Get and set cookies, ask questions from the visitor, and 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, the 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.

Code editor

A code editor is a place where we write the code and spend most of the time. In this tutorial, I am using the Visual Studio Code editor, which is user-friendly, powerful, and most recommended by programmers. The result of JavaScript code is displayed in a browser or in the VSCode editor only with some restrictions, but after installing server software (Node.js).

In this tutorial, I tried to cover most of the JavaScript topics, step by step, with solved examples.

This tutorial is for beginners and experts who want to revise JavaScript. Hope this tutorial is helpful for all users.

Prerequisite

A prerequisite for JavaScript is basic knowledge of HTML and CSS.

Your JavaScript Feedback, Question, Suggestion? Click here