JavaScript Quick Guide

Introduction

JavaScript brings life to web pages. It runs in every modern browser, allowing you to create interactive experiences, manipulate the DOM, and communicate with servers.

Basics

Variables, types, and operators are the building blocks.

let message = "Hello, World!";
const PI = 3.14159;
let sum = 5 + 7;
console.log(message, sum);

Functions

Encapsulate reusable logic.

function greet(name) {
  return `Hello, ${name}!`;
}
console.log(greet("Alice"));

DOM Manipulation

Interact with HTML elements.

const btn = document.querySelector("#myBtn");
btn.addEventListener("click", () => {
  document.body.style.background = "#f0f8ff";
});

Interactive Demo

Watch me change!

Try It Yourself