Last updated : July 27, 2026

JavaScript Introduction Tutorials

Programming

Introduction to JavaScript

  • Created in 1995 by Brendan Eich while working at Netscape.

  • Originally named Mocha, then LiveScript, and finally JavaScript.

  • Despite its name, JavaScript is not related to Java.

What is JavaScript?

JavaScript is a programming language used to make web pages interactive and dynamic.

Uses

  • Show alerts

  • Validate forms

  • Create animations

  • Handle button clicks

  • Fetch data from APIs

  • Build web applications

Example

plaintext

<script>
    alert("Welcome to JavaScript");
</script>

2. How JavaScript Works

JavaScript runs inside the web browser using the browser's JavaScript Engine.

Working Process

plaintext

HTML
   ↓
CSS
   ↓
JavaScript
   ↓
Browser
   ↓
Web Page

Steps

  1. Browser loads HTML.

  2. CSS styles the page.

  3. JavaScript executes.

  4. The page becomes interactive.

Example

plaintext

<button onclick="showMessage()">
    Click Me
</button>

<script>
function showMessage() {
    alert("Button Clicked");
}
</script>

2. History of JavaScript

  • 1995 → Brendan Eich created JavaScript in just 10 days.

  • 1996 → Renamed to JavaScript by Netscape to ride on Java’s popularity.

  • 1997 → Standardized by ECMA International as ECMAScript.

  • 2009Node.js introduced, allowing JavaScript to run on servers.

  • 2015 (ES6) → Major update with new features (let/const, arrow functions, classes, promises).

  • Today → JavaScript is one of the most widely used programming languages in the world.

3. Uses of JavaScript

 JavaScript is a multi-purpose language.

  • Web Development

    • Add interactivity to websites (menus, sliders, popups, form validation).

    • Example: When you click a button and something happens, that’s JS.

  • Front-end Frameworks

    • React, Angular, Vue → Build modern web apps.

  • Back-end Development

    • With Node.js, JavaScript runs on servers.

    • Example: Express.js for REST APIs.

  • Mobile Apps

    • React Native, Ionic → Build Android & iOS apps.

  • Desktop Apps

    • Electron.js → Create cross-platform desktop apps (e.g., VS Code).

  • Game Development

    • 2D/3D games using Phaser.js, Three.js.

  • AI/ML

    • TensorFlow.js, Brain.js → Machine Learning in JS.

4. Setup in Browser

=> Every modern browser (Chrome, Firefox, Edge, Safari) comes with a built-in JavaScript Engine.

  • Chrome → V8 Engine

  • Firefox → SpiderMonkey

  • Safari → JavaScriptCore

Example: Run JavaScript in Browser

Open your browser.

Press F12 (or Right Click → Inspect → Console).

javascript

// Write:

console.log("Hello, JavaScript!");

//  Output: Hello, JavaScript!

Using JavaScript in HTML:

plaintext

<!DOCTYPE html>

<html>

<head>

  <title>My First JS Example</title>

</head>

<body>

  <h1>Welcome</h1>

  <script>

    alert("Hello, Student! This is JavaScript running in your browser.");

  </script>

</body>

</html>

5. Setup in Node.js

 Node.js allows running JavaScript outside the browser (on a server).

Steps:

  1. Download & Install Node.js → https://nodejs.org

Verify installation in terminal/cmd:
node -v

  1.   Output: v20.0.0 (example)

  2. Run JavaScript file:

Create a file app.js:

console.log("Hello from Node.js!");

  • Run in terminal:

    node app.js

  1.  Output: Hello from Node.js!

Job PortalJobs