Course curriculum
Start with the JavaScript console
Run your first expressions and understand how JavaScript produces values and output.
About 7 minutes · BeginnerOpen a safe practice workspace
Open a blank browser tab and its developer tools Console. Type the examples yourself. A console evaluates JavaScript in the page context, so avoid pasting scripts you do not understand into websites where you are signed in.
You can later save JavaScript in a .js file and load it from an HTML page. For these lessons, the console is enough; no account or server is required.
Display a result
console.log displays a value. Strings use quotes; arithmetic expressions do not. An expression such as 4 * 5 is evaluated before the result is passed to console.log.
The console may also show undefined after a call to console.log. That is the return value of the call, not another line printed by your program.
console.log("Hello, student!");
console.log(4 * 5);Hello, student! 20
Work in small steps
Run one example at a time, then change one value and predict what will happen. This makes errors easier to understand.
A syntax error means the code could not be parsed. Check matching quotes, parentheses and braces before changing the logic.
Try it yourself
Print “Revision time” and then the number of minutes in two hours.
Show a possible solution
console.log("Revision time");
console.log(2 * 60);Keep exploring: official JavaScript documentation.