Free Ebook cover Complete HTML, CSS and Javascript course to become a Front End Developer

Complete HTML, CSS and Javascript course to become a Front End Developer

3.79

(14)

125 pages

Introduction to Javascript: variables, data types, operators: Operators in Javascript

Capítulo 69

Estimated reading time: 3 minutes

Audio Icon

Listen in audio

0:00 / 0:00
19.4. Introduction to Javascript: variables, data types, operators: Operators in Javascript

Javascript is a programming language that allows the creation of interactivity on web pages. It runs in the user's browser, which means that the code is processed on the user's computer and not on the server, as is the case with other programming languages. In this chapter, we will focus on operators in Javascript.

Operators in Javascript

Operators in Javascript are used to perform operations between variables and values. Operators are symbols that indicate an action to be performed. There are several types of operators in Javascript, including arithmetic operators, assignment operators, comparison operators, logical operators, and bitwise operators.

Arithmetic operators

Arithmetic operators are used to perform mathematical operations between numeric values. Arithmetic operators in Javascript include + (addition), - (subtraction), * (multiplication), / (division), % (modulus), ++ (increment), and -- (decrement).

Assignment operators

Assignment operators are used to assign values ​​to variables. The most common assignment operator is =, which assigns the value on the right of the operator to the variable on the left. Other assignment operators include +=, -=, *=, /=, and %=, which perform an arithmetic operation before assigning the result to the variable.

Comparison operators

Comparison operators are used to compare two values ​​and return a Boolean value that indicates whether the comparison is true or false. Comparison operators in Javascript include == (equal to), != (not equal to), > (greater than), < (less than), >= (greater than or equal to), <= (less than or equal to), === (equal to and of the same type) and !== (not equal to or not of the same type).

Continue in our app.

You can listen to the audiobook with the screen off, receive a free certificate for this course, and also have access to 5,000 other free online courses.

Or continue reading below...
Download App

Download the app

Logical operators

Logical operators are used to determine the logic between variables or values. Logical operators in Javascript include && (and), || (or) and ! (no).

Bitwise operators

Bitwise operators are used to manipulate the bits of a number. Bitwise operators in Javascript include & (bitwise AND), | (bitwise OR), ^ (bitwise XOR), ~ (bitwise NOT), << (left shift), >> (right shift) and >>> (right shift without signal).

Operators in Javascript are a fundamental part of the language and are used in almost all scripts. They allow programmers to perform complex operations with few lines of code. However, it is important to remember that operators must be used with caution, as inappropriate use can lead to unexpected results.

In summary, operators in Javascript allow programmers to perform a variety of operations, from simple mathematical calculations to complex comparisons and bit manipulations. Understanding how and when to use each type of operator is a fundamental skill for any Javascript programmer.

Now answer the exercise about the content:

What are the types of operators in Javascript mentioned in the text?

You are right! Congratulations, now go to the next page

You missed! Try again.

The text mentions the following types of operators in Javascript: arithmetic operators, assignment operators, comparison operators, logical operators, and bitwise operators. Therefore, option 1 correctly lists the types of operators mentioned in the text.

Next chapter

Control structures in Javascript: if, for, while

Arrow Right Icon
Download the app to earn free Certification and listen to the courses in the background, even with the screen off.