Instructions

Instruction is a command given to computer. JavaScript code is usually a set of instructions separated by ;.

Here is an example of code with two instructions.

console.log('Mother of Dragons.');
console.log('Dracarys!');

When you run this code you will see two sentences on the screen, one after the other.

Mother of Dragons.
Dracarys!

Actually, it’s possible to put multiple instructions on the same line:

console.log('Mother of Dragons.'); console.log('Drakarys!');

but it’s considered bad practice as it’s hard to read.

Interpreter, the program which executes code in JavaScript needs such splitting. This interpreter in JavaScript world is any browser (as it’s able to JavaScript code) or Node.js (in the same reason). The operation principle of any interpreter is (approximately) as follows. It reads the file with code, splits it into instructions and then executes them in turn.

instructions

Output these three names on the screen, one after the other: “Robert”, “Stannis”, “Renly”.

Robert
Stannis
Renly

For each name call it’s own console.log()

tips:


definitions

  • interpreter — A program executing code in JavaScript

  • Statement — A command given to computer. JavaScript code is a set of instructions separated (most frequently) by ;.


If you got stuck and don't know what to do, you can ask a question in our huge and friendly community
Exercise available only for signed users.

Please sign in with your GitHub account, this is necessary to track the progress of the lessons. If you do not have an account yet, now is the time to create an account on GitHub.