Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Comparison Operators | Section
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
JavaScript Essentials for Beginners - 1768407374405

bookComparison Operators

Note
Definition

Comparison Operators, as expressed by the name, are operators that can be used for comparing data.

For example, we can use the equals to (==) operator to check if two values are equal. This outputs true or false based on whether the two values are equal or not.

123
let a = 5; let b = 10; console.log(a == b);
copy

The expression a == b is known as a boolean expression because it evaluates into a boolean value (true or false).

Note
Note

The equals to operator (==) is not the same as the assignment operator (=).

There's a similar operator known as the not equals to (!=) operator. It simply returns true if the two values are not equal:

123
let a = 5; let b = 10; console.log(a != b);
copy

There are some other operators which can be used for comparing values:

1. What will be the output of the following code?

2. Which of the following operators checks if two values are equal?

3. What is the difference between = and == in JavaScript?

4. What will be the output of this code?

5. Which of the following statements will return true ?

question mark

What will be the output of the following code?

Select the correct answer

question mark

Which of the following operators checks if two values are equal?

Select the correct answer

question mark

What is the difference between = and == in JavaScript?

Select the correct answer

question mark

What will be the output of this code?

Select the correct answer

question mark

Which of the following statements will return true ?

Select all correct answers

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 30

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

bookComparison Operators

Deslize para mostrar o menu

Note
Definition

Comparison Operators, as expressed by the name, are operators that can be used for comparing data.

For example, we can use the equals to (==) operator to check if two values are equal. This outputs true or false based on whether the two values are equal or not.

123
let a = 5; let b = 10; console.log(a == b);
copy

The expression a == b is known as a boolean expression because it evaluates into a boolean value (true or false).

Note
Note

The equals to operator (==) is not the same as the assignment operator (=).

There's a similar operator known as the not equals to (!=) operator. It simply returns true if the two values are not equal:

123
let a = 5; let b = 10; console.log(a != b);
copy

There are some other operators which can be used for comparing values:

1. What will be the output of the following code?

2. Which of the following operators checks if two values are equal?

3. What is the difference between = and == in JavaScript?

4. What will be the output of this code?

5. Which of the following statements will return true ?

question mark

What will be the output of the following code?

Select the correct answer

question mark

Which of the following operators checks if two values are equal?

Select the correct answer

question mark

What is the difference between = and == in JavaScript?

Select the correct answer

question mark

What will be the output of this code?

Select the correct answer

question mark

Which of the following statements will return true ?

Select all correct answers

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 30
some-alt