JAVASCRIPT · ОСНОВЫ · LESSON 16

Your command.

Function · about 12 minutes

Learning with progressRead the summary for free. To save the work, log in to the account.
STEP 1

Name the action.

function creates a command with a name. The code inside the brackets will run when you call the function.

function wave() {
  console.log("Привет!");
}

✦ So far, the function has just been created.

STEP 2

Call the function.

To make the command work, write its name with parentheses.

function wave() {
  console.log("Привет!");
}
wave();

✦ There's going to be Hello!

IN-CLASS PRACTICE

Type the code yourself

Type an example manually. Check the names, brackets and signs.

function cheer() {
  console.log("Ура!");
}
cheer();
Open the editor for class work
HOMEWORK

Solve it yourself

Create a hello function that outputs «Здравствуй!». Then call hello.

The answer is hidden. Use similar examples from the lesson notes.

Opening up your homework