Give your first command
Programming is giving a machine orders and watching it obey instantly. There's no magic: you write, the computer does. And you're about to see it for yourself.
Below, under "Try it yourself", is your first program. Press Run and watch what shows up in the console. (Relax: you don't need to understand every word yet. First, just feel it.)
What is JavaScript?
JavaScript (JS) was born in 1995 to bring web pages to life. Today it's one of the most widely used languages in the world and runs almost everywhere:
- In the browser, to create interactive web pages.
- On the server, thanks to Node.js.
- In mobile and desktop applications (like this very app).
Why is it great to start with?
Because it's interpreted: you don't have to compile or wait for anything. You write a line, press Run, and see the result instantly. That immediate feedback is exactly what makes learning addictive.
The console: your window into the code
The tool you'll use most at the start is console.log(): it displays any value so
you can see and inspect it. You've got it in action right below. 👇
Examples
Your first program — press Run
console.log("Hi! I'll do exactly what you tell me. 🤖");
console.log("Adding 1 to 100 by hand would take a while...");
console.log("For the computer:", (100 * 101) / 2, "← instantly ✨");
The console also calculates
console.log("Movie tickets:", 3);
console.log("Total to pay:", 3 * 9, "$");
console.log("Twice 21 is", 21 * 2);