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
- MDN — JavaScript guide — the official docs written by browser makers
- javascript.info — a complete tutorial in plain language with examples
- freeCodeCamp — free interactive exercises and certificates
Video lesson
Practice JavaScript
Print two lines:
Salom, JavaScript!
2 + 2 = 4
Let JavaScript calculate the 4 in the second line itself.
Write your code and press «Run».
Show solution
console.log("Salom, JavaScript!");
console.log("2 + 2 =", 2 + 2);