JavaScript · Beginner

JavaScript Fundamentals with Real Examples

Learn variables, arrays, functions, events and async programming with short browser-ready examples.

JavaScript powers interaction on the web. Understanding the fundamentals is useful whether you plan to use vanilla JavaScript, React or backend JavaScript.

What you will learn

  1. Variables and values
  2. Arrays and functions
  3. Async and network requests
CHAPTER 01

Variables and values

Use const by default and let when a binding must change. Values such as strings, numbers, booleans, arrays and objects can be composed to model real app data.

const project = { name: "CodingPremise", isFree: true };
console.log(project.name);
CHAPTER 02

Arrays and functions

Functions encapsulate logic; array methods like map and filter transform collections without manual index management.

const scores = [12, 20, 28];
const passed = scores.filter(score => score >= 20);
console.log(passed);
CHAPTER 03

Async and network requests

async functions make Promise workflows easier to read. Always handle failures, and never embed private API keys in client-side JavaScript.

async function loadData(url) {
 const response = await fetch(url);
 if (!response.ok) throw new Error("Request failed");
 return response.json();
}

Practice the concepts

Use a related utility to experiment, check examples, and build a small project.

Open JavaScript runner ↗