LearnJS

JavaScript Basics

JavaScript is a versatile, high‑level programming language that powers interactive web pages. It runs in browsers and on servers via Node.js.

Variables

Use let, const, or var to store values.

let name = "Alice";
const PI = 3.1415;
var age = 30;

Functions

Declare reusable blocks of code.

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

Interactive Example

Write JavaScript code below and see the result instantly.

DOM Manipulation

JavaScript can modify HTML elements dynamically.

document.body.style.background = "#ffefef";