Introduction

JavaScript is a lightweight, interpreted programming language used to make web pages interactive. It runs in the browser and is essential for web development.

Variables

Variables store data values that can be reused throughout your code. Use let, const, or var to declare them.

let name = "Diana";
const pi = 3.14;
var age = 25;
Functions

Functions are blocks of code designed to perform a specific task. They can take inputs and return outputs.

function greet(name) {
  return `Hello, ${name}!`;
}
Loops

Loops are used to repeat code multiple times. The most common types are for and while.

for (let i = 0; i < 5; i++) {
  console.log(i);
}
Arrays

Arrays store multiple values in a single variable.

const fruits = ["apple", "banana", "cherry"];
console.log(fruits[1]); // banana
← Back to Home