Conteúdo do Curso
Introduction to JavaScript (staging)
Introduction to JavaScript (staging)
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.
// (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);
Description of above code
- Numerical operators usually perform some numerical actions on the variable.
- Bitwise operators treat their operands as a set of 32-bit binary digits (zeros and ones) and perform actions.
- The logical operator returns true or false based on condition.
- We use assignment operators to assign values to the variable.
- Relational operators are for checking the relation between operands.
Note:
The complete detail of operators will be discussed later in the course.
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.
Obrigado pelo seu feedback!
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.
// (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);
Description of above code
- Numerical operators usually perform some numerical actions on the variable.
- Bitwise operators treat their operands as a set of 32-bit binary digits (zeros and ones) and perform actions.
- The logical operator returns true or false based on condition.
- We use assignment operators to assign values to the variable.
- Relational operators are for checking the relation between operands.
Note:
The complete detail of operators will be discussed later in the course.
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.
Obrigado pelo seu feedback!
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.
// (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);
Description of above code
- Numerical operators usually perform some numerical actions on the variable.
- Bitwise operators treat their operands as a set of 32-bit binary digits (zeros and ones) and perform actions.
- The logical operator returns true or false based on condition.
- We use assignment operators to assign values to the variable.
- Relational operators are for checking the relation between operands.
Note:
The complete detail of operators will be discussed later in the course.
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.
Obrigado pelo seu feedback!
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.
// (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);
Description of above code
- Numerical operators usually perform some numerical actions on the variable.
- Bitwise operators treat their operands as a set of 32-bit binary digits (zeros and ones) and perform actions.
- The logical operator returns true or false based on condition.
- We use assignment operators to assign values to the variable.
- Relational operators are for checking the relation between operands.
Note:
The complete detail of operators will be discussed later in the course.
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.