🟨

JavaScript Fundamentals

Level
11 lessons74 exercises~20h

74 hands-on exercises to learn JavaScript from scratch. Variables, math, arrays, objects, classes, DOM manipulation, async programming and REST APIs, all runnable in your browser.

01. Variables & Basics

Variables, alerts, prompts and conditionals.

What you will learn

Every JavaScript program starts with variables — named containers that store values. In this lesson you will declare variables, interact with the user through alert() and prompt(), and make decisions with if / else.

Key concepts

  • let and const — block-scoped variable declarations
  • alert() — display a message to the user
  • prompt() — ask the user for input (returns a string)
  • confirm() — ask a yes/no question (returns a boolean)
  • if / else if / else — conditional execution

Exercises (4)

Variables & Alert

Create a variable with the name of your choice and set its value to the string "Hello, World!". Display it using console.log().

JavaScript
Output
Click "Run" to execute your code...

Free forever, no ads, no tracking. Support the project