Hey! If you want to learn how to code, but don’t know where to start, I’ll help you. We will start learning from the very beginning. Let’s figure out what a function is, how a string differs from a number, how to create conditionals and loops.

If you have any questions in the process, you can ask them in Telegram . I usually respond within an hour.

What is JavaScript

JavaScript is the most popular programming language in 2021. It can be used to create sites, games, mobile applications and complex server systems.

You can often find the abbreviation JS. There is no difference between JS and JavaScript, you can use any word.

How to learn JavaScript

I assume that you do not understand anything at all about programming, so part of the assignment will be to simply rewrite the code by example. I will give the correct version and you will enter it until the characters match.

Lines with at least one error will turn red - they will need to be corrected.

Lines without errors will be green.

In other tasks, I will check the output on the screen and will not pay attention to how you achieved the correct result.

First command

All programming is about telling the computer “what we want from it.” In other words, we give commands to the computer, and it executes them.

One of the simplest commands is to display text on the screen. In JavaScript, it looks like this:

console.log('Hello, world!');

A message will appear on the screen

Hello, world!

If you write another message inside console.log(), then the message displayed by the computer will also change.

You can add one more text output command:

console.log('Hello, world!');
console.log('JavaScript is fun :)');

Another message on a new line will appear on the screen.

Hello, world!
JavaScript is fun :)

Quotes

When you ask (or order) the computer to display text on the screen, it expects you to give it that text wrapped in quotation marks.

The quotes can be single, double, or oblique. Any option is suitable

console.log ('hello');
console.log ("hello");
console.log (`hello`);

In all cases, the same message will be displayed on the screen and we will see three lines:

hello
hello
hello

Coding tasks

To better understand the theory, you must definitely practice. If you borrow in a mobile application, then under the terms of the tasks you will see a field for entering text and the number of the task to be checked.

The logic is this:

  • we read the condition of task 1
  • enter the code in the text field under the list of all tasks
  • select (1) from the list of tasks to check
  • press the “RUN” button

After running the code, the screen output will appear under the button. If there are any problems with the code, then their description will also be there.

If you make a mistake, then, depending on the type of task, either the lines inside the field for entering the code, or the lines of the screen output will be highlighted in red.

Go!

Task 1

You need to display the string Hello, world!.

Enter the command in the code editor

console.log('Hello, world!');

And click on the “RUN” button. Every symbol counts!

Task 2

You need to print the string Hello, world! Twice using different types of quotes and make sure that the result does not change.

Enter the commands in the code editor

console.log('Hello, world!');
console.log("Hello, world!");

Change the task for testing (2) and click “RUN”.

Task 3

Print the string JavaScript is great!. You can use any quotation marks.

Don’t forget to change the task before editing the code and running it.