0Pricing
JavaScript Academy · Lesson

First Program & I/O (console, alerts in browser)

Write your first small programs and practice I/O: console output in any runtime and alerts in the browser.

Intro

Goal: Print messages clearly and safely. You'll use console.log everywhere and alert in the browser.

  • Tiny program
  • Console basics
  • Alert with fallback

First console output

Create a simple function, call it, and print the result with console.log.

// A tiny first program
function hello(name) {
  return "Hello, " + name + "!";
}

const message = hello("Coder");
console.log(message);

All lessons in this course

  1. What is JavaScript? Engines (V8/SpiderMonkey) & Runtimes (Browser vs Node)
  2. Setup: Node + npm, Running .js, DevTools Console
  3. First Program & I/O (console, alerts in browser)
← Back to JavaScript Academy