Boolean Expressions Reading assignment

  1. Operators perform actions. Putting an operator between two values
    will apply it to those values and produce a new value

  2. Booleans

  3. &&, ||

1 Like

Excellent answers, Luís! :muscle:

1 Like

Hi @SDoyle,

Great examples of operators for Q2 & 3 :ok_hand:

… the key here is that operators perform defined actions on values.

2 Likes

Hi @cincinnato!

Q1 & 3 :+1:

These are Boolean values, not binary operators.
Have a look at this post for some examples.

2 Likes

Q1: Operators are anything that can be used to manipulate a value such as +, -, *, and / signs

Q2: Binary operators are as follows Equal (==), Not equal (!=), Greater than or equal to (>=), Less than or equal to (<=)

Q3: Logical AND (&&), and Logical OR (||) and Not(!)

1 Like

In Boolean expressions are symbols that considering the given values they then determines if the result will be “true” or “false”

“>” greater than
“<” less than
“>=” greater than or equal to
“<=” less than or equal to
“==” equal to
“!=” not equal to

examples:

(10>9) will give true as result
(10<9) will give false as result
(10>=9) will give true as result
(10<=9) will give false as result
(10==9) will give false as result
(10!=9) will give true as result

Logical AND , the && operator represents logical and. It is a binary operator, and its result is true only if both the values given to it are true.
Logical OR ( || ) , the || operator denotes logical or. It produces true if either of the values given to it is true.
Logical NOT ( ! ) , the ! operator, It is a unary operator that flips the value given to it—!true produces false, and !false gives true.

examples:

(true&&true) will give as result true
(true&&false) will give as result false
(false||true) will give as result true
(true||false) will give as result true
!true will give as result false
!false will give as result true

1 Like

Operators are symbols that produce boolean values.
Binary operator symbols are less than, more than, equal to and combinations of them.
Logical operators are &&, ||, ! (and, or, not)

1 Like

Hi @Colin358,

Questions 1 and 3 :ok_hand:

No…here, binary means that a single operator acts on two values
i.e.  < > + -  are all individual binary operators. It’s got nothing to do with pairs of opposite actions, although that’s a nice way to group them.

Here are some examples of the binary operators you’ve mentioned in action. The values in the comments on the right are what would be logged to the console.

console.log(5 > 3);     // => true
console.log(5 < 3);     // => false
console.log(5 + 3);     // => 8
console.log(5 - 3);     // => 2
2 Likes

Hi @Dylan22,

Q1 & 3 :ok_hand:

No…Booleans are values (true and false) not operators.
Have a look at this post for some examples of binary operators.
Comparison operators (a type of binary operator) act on two values by comparing them, and produce Boolean values as a result. Have a look at this post for an example.

I hope that makes things clearer.

1 Like

You’ve given an excellent explanation and examples of how comparison operators and logical operators are used in Boolean expressions to produce true or false values.

Impressive stuff, @Steve199! :muscle:

2 Likes
  • What are operators?
    Operators are objects that manipulate values, assigning, comparing or performing arithmetic functions.

  • What binary operators do you know?
    Arithmetic Operators, Assignment, String, Equal to,

  • What logical operators do you know?
    And &&
    Or ||
    Not !

1 Like

Good answers, @Debbie_Stevens :ok_hand:

Yes, that’s correct…but operators perform other actions on values too, such as mathematical operations e.g  + - * / %

console.log(6 + 3);   // => 9
console.log(6 - 3);   // => 3
console.log(6 * 3);   // => 18
console.log(6 / 3);   // => 2
console.log(6 % 3);   // => 0
2 Likes

Hey thanks for clarifying, I see it now.

1 Like
  1. An operator is a basic function that can be applied to a given number of variables or expressions.
  2. arithmetic addition, subtraction, multiplication, division, string concatenation, etc.
  3. boolean and, boolean or, not, etc.
1 Like
  1. operators are what computes the values

  2. ==,!=,<,>,>=,<=,&&,ll,+,-,*,/

  3. &,^,l

1 Like
  1. an operator is an object that is capable of manipulating a value.

  2. +, -, *, /

  3. and , or, not

1 Like
  1. Operators are used to assign and compare value, and also execute arithmetic operations and much more.

  2. <, >, +, -, !=, &&, ||, *, /

  3. “And” “Or” “Not” “&&” “||”

1 Like
  1. What are operators?
    Operators give commands to values

  2. What binary operators do you know?
    Plus (+), minus (-), divide (/), multiply (*)

  3. What logical operators do you know?
    Or (||), and (&&), not (!)

2 Likes
  1. Methods applied to manipulate values
  2. <, >, <=, >=, ==, !=
  3. && (and), || (or)
1 Like
  1. What are operators?

The symbols or certain words we use in the programming language to do the following tasks:

  • assign and compare values
  • perform arithmetic operations
  • convert numeric operands
  • request the type of data or the existence of a specified property the object
  • delete object properties
  • evaluate expressions

We distinguish between 4 categories:

  • arithmetic operators
  • comparison operators (relational or equality oriented, returning a boolean value)
  • assignment operators
  • logical operators

The computations are performed either in unary form with 1 variable, binary with 2 variables or ternary with 3 variables. The binary form is the most common.

  1. What binary operators do you know?
+
-
*
/
%
==
!=
<=
>=
<
>
=
+=
-=
/=
%=
*=
&&
||
  1. What logical operators do you know?
  • “and” (binary): &&
    returns true if both variables or values given to it are true

  • “or” (binary): ||
    returns true if either of the variables or values given to it are true

  • “not” (unary): !
    flips the succeeding boolean value and returns it

  • “conditional” (ternary): ?:, operating on 3 values (true/false ? 1 : 2)
    the boolean value determines which of the other two values gets returned

1 Like