JavaScript basics

  1. Hello, World!
  2. Comments
  3. instructions (Statements)
  4. How we check your solutions
  5. Syntax errors

JavaScript is one of the most popular programming languages in the world. It is used to create interactive web pages, mobile applications, and in server-side development. We will learn JS from scratch, from the very basics. The first module is a springboard for writing meaningful programs. In it, we will learn how to write your first code in JS. We will tell you what comments are and why you need them. On the example of checking your decisions, we will consider what testing is and how to read test output.

Arithmetic

  1. Arithmetic operations
  2. Operators
  3. Commutative operation
  4. Composition of operations
  5. Priority of operations
  6. floating point numbers
  7. Infinity
  8. NaN
  9. Linter

Modern programs are created to serve businesses, help with daily life, and entertain. But at the heart of their operation is still computation. The simplest and most basic topic in programming is arithmetic. In this module, we’ll translate arithmetic operations into a programming language, talk about operation precedence and fractional number operations. We’ll remember school rules from math lessons and learn what happens if you divide by zero in JavaScript. And at the end we’ll tell you what a linter is and why it can “swear”.

Lines

  1. Quotation marks
  2. Shielding sequences
  3. Concatenation
  4. Encoding

Text in programming is called “strings”, and this topic is not as simple as it may seem. How do you output a phrase that has both single and double quotes? How to deal with text at all, since the computer knows nothing about letters! The module deals with different aspects of writing text, from quotation marks and escaping to encoding.

Variables in JavaScript

  1. What is a variable
  2. Changing a variable
  3. Choosing a variable name
  4. Errors when working with variables
  5. Expressions in definitions
  6. Variables and concatenation
  7. Naming styles
  8. Magic numbers
  9. Constants
  10. Interpolation
  11. Extracting characters from a string

Information can be placed into special “storages” – variables. This allows you to reuse existing data and not to duplicate it in different parts of the code. In this module, we will show you how to change variables and name them so that reading your code will be understandable for any developer. You will realize that it is not so easy to come up with a variable name! We will also tell you how to use variables to simplify complex calculations.

JavaScript data types

  1. Data types
  2. undefined
  3. Immutability of primitive types
  4. Weak typing

JavaScript is a language with weak typing and immutable primitive data types. What happens if we try to multiply a number by a string? How does JavaScript understand what data type is in front of it? And what does JavaScript do when it sees a type mismatch? You’ll find the answers to these questions in the current module.

Calling functions

  1. Functions and their calls
  2. JavaScript math functions
  3. Function Signature
  4. Default parameters
  5. Function call – expression
  6. Functions with a variable number of parameters
  7. Determinism
  8. Standard library

To express any arbitrary operation in programming, there is a concept of “function”. Functions are the building blocks from which programmers construct systems. In this module, we will learn how to use functions that have already been created. We will look at the function signature in the documentation and understand how to use it. We’ll familiarize ourselves with the standard libraries that store thousands of functions. It is impossible to learn all functions, but every programmer should know where to find documentation on them.

Properties and Methods

  1. Properties
  2. Methods
  3. Immutability
  4. Properties and methods as expressions
  5. Call chain

The data we operate on in our programs can have important properties. In JavaScript, properties are built right into the language. In addition to properties, data has methods – functions that are inside properties. Properties and methods are expressions like variables, constants or function calls, which means that they can be combined in many ways. These topics are covered in more depth in separate courses on the object-oriented features of JavaScript. In this module, we’re going to learn the basics.

Defining functions

  1. Creating (defining) functions
  2. Return values
  3. Function Parameters
  4. Optional parameters of functions
  5. Simplified function syntax

Defining your own functions makes it much easier to write and maintain programs. For example, the ability to define functions allows you to combine complex (compound) operations into one – all the complexity can be hidden behind one simple function. Learning to write functions, you will make the first step on the way to building really useful programs. And we’ll help you do just that. In this module, you will create your first function and learn how to give it (and variables and constants) a clear name.

Logic

  1. Logic type
  2. Predicates
  3. Combining logical operations
  4. Logical operators
  5. Negation
  6. Result of logical expressions

Logical expressions allow you to answer questions that arise during program operation. Is the user authenticated? Has the subscription been paid? Is the year high? In this module, we study predicate functions – those that ask a question and answer it – true or false. We’ll practice writing such functions and move on to more complex logical expressions.

Conditional constructions

  1. Conditional construct (if)
  2. else
  3. The else if construction
  4. Ternary operator
  5. Switch construct

The task of a predicate function is to get an answer to a question, but usually this is not enough and it is necessary to perform a certain action depending on the answer. If and Switch are JavaScript constructs with the help of which the programmer can choose the necessary program behavior depending on different conditions: skip some instructions and execute others. We’ll study them in practice in this module.

Cycles

  1. While loop
  2. Data Aggregation (Numbers)
  3. Data aggregation (Strings)
  4. String traversal
  5. Conditions inside the loop body
  6. Forming strings in loops
  7. Syntactic sugar
  8. Increment and decrement
  9. Returns from loops
  10. For loop

Any code can be repeated tens, thousands, millions of times. In combination with other tools we know – variables and conditions – it opens many possibilities for building programs and complex systems. Here is a simple example. You need to find a particular phrase in a 500-page textbook. You remember the phrase, but not the page number. The easiest (and longest) way is to sequentially look through the pages until you find the right one. Loops are needed to perform such repetitive actions.