JavaScript

Lesson 1 of 11

Lesson ยท 5 min

Say hello

Your first program

A program is a list of instructions that a computer follows, one line at a time. In JavaScript, one of the most useful instructions is console.log. It writes a message to the console, the panel below the editor.

console.log('Good morning!');

The message in quotation marks is called a string. A string is a piece of text. You can use single quotes 'like this' or double quotes "like this".

Two details matter:

  • console.log starts with a lower-case c. JavaScript treats Console and console as different names.
  • The line ends with a semicolon ;. The semicolon marks the end of an instruction.

Your turn

Write your code in the editor, then press Run to see the output. When you think you are done, press Check my work.

Tasks

2 to do

  1. Task 1, not checked yet. Print the text Hello, world! with console.log.

  2. Task 2, not checked yet. On the next line, print I am learning JavaScript.

Task 1 of 2

Print the text Hello, world! with console.log.

All tasks

main.js

Ctrl+Enter runs your code. Ctrl+Shift+Enter checks it. Press Esc, then Tab, to leave the editor.

Output

Press Run to see your result

Your output shows here. Press Run to try your code.