Input is data a program receives — from a user, a file, or another program. Output is what the program produces in response. Almost every useful program is, at its core, a cycle of input → processing → output.
In examples throughout this site, console.log() is used to print output — in a real webpage, output usually means updating something on the screen instead.
console.log("This is program output.");A simple way to accept input from a person in the browser is prompt(), which pops up a small input box and returns whatever the user typed, as a string.
let name = prompt("What is your name?");
console.log("Hello, " + name + "!");prompt() always returns a string — if you ask for a number, remember to convert it with Number() before doing math with it (see the Type Casting lesson).
Beyond simple pop-ups, programs get input from web forms, files, databases, sensors, or other programs over the network — and send output to a screen, a file, a database, or across the network. The core idea is always the same: bring data in, process it, send results out.