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
- What is JavaScript? Engines (V8/SpiderMonkey) & Runtimes (Browser vs Node)
- Setup: Node + npm, Running .js, DevTools Console
- First Program & I/O (console, alerts in browser)