Mark As Completed Discussion

Try this exercise. Fill in the missing part by typing it in.

In JavaScript, the comparison operators are used to compare values and return a boolean result. Some common comparison operators in JavaScript are:

  • Equal To (==): Returns true if the operands are equal.
  • Not Equal To (!=): Returns true if the operands are not equal.
  • Strict Equal To (===): Returns true if the operands are equal and of the same type.
  • Strict Not Equal To (!==): Returns true if the operands are not equal or not of the same type.

The logical operators in JavaScript are used to combine or negate boolean values. The logical operators in JavaScript are:

  • Logical AND (&&): Returns true if both operands are true.
  • Logical OR (||): Returns true if at least one of the operands is true.
  • Logical NOT (!): Returns the opposite boolean value of the operand.

In JavaScript, the assignment operator (=) is used to assign a value to a variable. For example:

JAVASCRIPT
1let x = 10;

The value 10 is assigned to the variable x using the assignment operator (=).

Another important operator in JavaScript is the ternary operator, also known as the conditional operator. It is used to simplify conditional expressions and provide a compact syntax. The syntax of the ternary operator is:

JAVASCRIPT
1condition ? expression1 : expression2;

The condition is evaluated first, and if it is true, the expression1 is executed. Otherwise, the expression2 is executed. The result of the ternary operator is the value of the executed expression.

Using the knowledge from the previous screen, fill in the blank for the following statement:

In JavaScript, the comparison operators are used to compare values and return a ___ result.

Write the missing line below.