o‘zing o‘rgan
JavaScript Basics Lesson 1 / 19
Qunduz

What is JavaScript? console.log()

The language that brings websites to life, and your first program

Chapter 1. Basics 10 minutes Video JavaScript 3 questions

JavaScript is the language of the web. Whenever something happens on a website when you click a button, a menu opens or a game runs — that is JavaScript. Today it also runs on servers (Node.js) and in mobile apps.

To show something in the console, use console.log():

console.log("Hello, world!");
// Output: Hello, world!

Text goes inside quotes, numbers are calculated:

console.log(7 + 5);     // Output: 12
console.log("7 + 5");   // Output: 7 + 5
console.log("Age:", 14);
// Output: Age: 14

💡 Text after // is a comment — JavaScript ignores it. The ; at the end of a line marks the end of a statement.

Common mistakes

  • Console.log(...) — capital letter! JavaScript is case-sensitive.
  • console.log("hi) — the quote is not closed → SyntaxError.

📚 Free resources

Video lesson

Practice JavaScript

Print two lines:

Salom, JavaScript!
2 + 2 = 4

Let JavaScript calculate the 4 in the second line itself.

main.js Ctrl+Enter — run
Write your code and press «Run».
Show solution
console.log("Salom, JavaScript!");
console.log("2 + 2 =", 2 + 2);

Check yourself

Question 1 / 3

What does console.log("3 + 4") print?

Choices

Question 2 / 3

Where does JavaScript run?

Choices

Question 3 / 3

Which line is a comment?

Choices