JavaScript Essentials

This page explains core JavaScript concepts in a beginner-friendly, concise way. No accounts, no data collected, and 100% privacy-safe.

1. Variables

Variables store data in JavaScript. Use let, const, or var.

let age = 18;
const siteName = "LearnJS";

2. Identifiers

Identifiers are the names you give to variables, functions, etc. They must start with a letter, _, or $.

let _score = 100;

3. Keywords

These are reserved words in JavaScript, like let, function, return, and can’t be used as variable names.

function greet() { return "Hi"; }

4. Operators

Operators perform actions on values. Example types:

5. Scope of Variables

Scope determines where a variable is accessible:

{ let a = 10; } ← only accessible inside block

6. Integrating APIs

You can use JavaScript to connect to other services using APIs (Application Programming Interfaces).

Example: Fetching JSON from a URL:

fetch("https://api.example.com/data")
  .then(res => res.json())
  .then(data => console.log(data));