Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
JavaScript Operators | JavaScript syntax
Introduction to JavaScript (staging)
course content

Зміст курсу

Introduction to JavaScript (staging)

Introduction to JavaScript (staging)

1. Introduction
2. JavaScript syntax
3. Data Types and Variables

book
JavaScript Operators

We use operators to perfor some actions on the operands. Operands can be variables, numeric literals, or string literals.

JavaScript Operators Syntax:

We can use the operators between two or more operands to perform a specific task.

12345678910111213141516171819
// (numerical operator) const sum = 45 + 2; console.log(sum); // (bitwise operator) const value = 5 | 1; console.log(value); // (logical operator) const isRaining = true; console.log(isRaining); //(assignment opearator) const number = 5; console.log(number); // (relational operator) const isLess = 45 == 10; console.log(isLess);
copy

Description of above code

  1. Numerical operators usually perform some numerical actions on the variable.
  2. Bitwise operators treat their operands as a set of 32-bit binary digits (zeros and ones) and perform actions.
  3. The logical operator returns true or false based on condition.
  4. We use assignment operators to assign values to the variable.
  5. Relational operators are for checking the relation between operands.

Note:

The complete detail of operators will be discussed later in the course.

Завдання
test

Swipe to show code editor

Create three variables named firstItem, secondItem, and difference. Assign the values 50 and 20 to firstItem and secondItem respectively. Find the difference and assign the value to the difference variable and display it.

Summary:

  • The syntax is a set of rules which defines a program is true or not.
  • JavaScript has two types of values: literals and variables.
  • Literals cannot be can not change the code and we do not specify any keywords.
  • Variables are used to store data. They are declared with name (which is not a keyword) and usually initialized with a value.
  • Operators are used to perform some actions.
  • JavaScript operators are used to perform special operations.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 3
toggle bottom row

book
JavaScript Operators

We use operators to perfor some actions on the operands. Operands can be variables, numeric literals, or string literals.

JavaScript Operators Syntax:

We can use the operators between two or more operands to perform a specific task.

12345678910111213141516171819
// (numerical operator) const sum = 45 + 2; console.log(sum); // (bitwise operator) const value = 5 | 1; console.log(value); // (logical operator) const isRaining = true; console.log(isRaining); //(assignment opearator) const number = 5; console.log(number); // (relational operator) const isLess = 45 == 10; console.log(isLess);
copy

Description of above code

  1. Numerical operators usually perform some numerical actions on the variable.
  2. Bitwise operators treat their operands as a set of 32-bit binary digits (zeros and ones) and perform actions.
  3. The logical operator returns true or false based on condition.
  4. We use assignment operators to assign values to the variable.
  5. Relational operators are for checking the relation between operands.

Note:

The complete detail of operators will be discussed later in the course.

Завдання
test

Swipe to show code editor

Create three variables named firstItem, secondItem, and difference. Assign the values 50 and 20 to firstItem and secondItem respectively. Find the difference and assign the value to the difference variable and display it.

Summary:

  • The syntax is a set of rules which defines a program is true or not.
  • JavaScript has two types of values: literals and variables.
  • Literals cannot be can not change the code and we do not specify any keywords.
  • Variables are used to store data. They are declared with name (which is not a keyword) and usually initialized with a value.
  • Operators are used to perform some actions.
  • JavaScript operators are used to perform special operations.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 3
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt