Boolean Expressions Reading assignment

  1. Operators are symbols or words used to signify the operations we want to perform on values.
  2. As binary operators are operators that use 2 values, almost all javascript arithmetic, relational, logical, string, comparison and assignment operators are binary. Exceptions include unary operators where only one value is used eg “typeof” and “-”.
  3. JavaScript supports three logical operators: and, or, and not. (&&, ||, !)
1 Like

What are operators?
Operators are the simplest functions which operate with values (for example: +, -, *, /).

What binary operators do you know?
Multiplication, addition, subtraction, division, equality, etc…

What logical operators do you know?
And, or and not - &&, || and (!).

1 Like
  1. operators are symbols that give variables a value
  2. binary operators are + - * / %
  3. logical operators are && || !
1 Like

What are operators?

Operators provide an vast array of actions which can be performed on values in Javascript. For example you can assign a value to a variable with the = sign. You can subtract one number from another number with the - sign. You can also make comparisons with logical operators.

What binary operators do you know?

  1. = assignment operator
  2. + adition operator
  3. - subtracton operator
  4. * multiplication operator
  5. / division operator
  6. % modulus operator
  7. > greater than operator
  8. < less than operator
  9. == epual to operator
  10. != not equal to

What logical operators do you know?

I know the following logical operators

  1. && returns true if object a and b are true
  2. || returns true if either object a or b are true
  3. true/false ? 1 : 2 this one just picked up from the book a ternary conditional where the value on left of question mark picks from one value on the right. if true the value to left of colon is picked and if false the value on right. have used it before in demo code but never understood it till now.
1 Like

Great analysis @AliasFresh! :+1:

Glad I helped there :wink:
Logical NOT (!) and typeof operators are also unary (not binary) operators — which makes sense if you think about it.

1 Like

Nice work @Long :ok_hand:

You may be interested to know that…

Logical NOT ( ! ) and typeof operators are unary (not binary) operators, because they only operate on one value (not two). Other examples of unary operators are ++ (increment operator) and -- (decrement operator), and you’ll come across those a bit later in the course.

Basically, whether unary, binary, ternary or logical etc… what all operators have in common is that they all perform different kinds of actions on values.

1 Like

Great analysis @Beryl :+1:

Not sure if it was a slip or formatting error, but:

-   // binary, arithmetic operator
--  // unary, decrement operator

Logical NOT (!) is also a unary operator — which makes sense if you stop to think about it.

2 Likes
  1. What are operators?
    Operators manipulate values *±/%??++
  2. What binary operators do you know?
    relational,logical,string,comparison, arithmetic
    operators that use two values are binary operators
  3. What logical operators do you know?
    And&&,orII,not!
1 Like
  1. What are operators?
    Operators are special symbols that help interact two values with each other in the program. -+/% =
  2. What binary operators do you know?
    < > == != && || *
  3. What logical operators do you know?
    and, not, or
1 Like

NIce answers @LAVATOR :ok_hand:

Just to add…

That’s right for binary operators… but operators can also perform an action on just one value (which can also be an expression). These are called unary operators:
The NOT (!) operator is actually a unary operator, as well as a logical operator (which makes sense if you think about it). You’ll learn about some more of them later in the course (e.g. ++ and -- ).

There is also something called a ternary operator that performs an action on 3 values. Look it up if you haven’t heard of it… it’s pretty cool :sunglasses:

1 Like

Yes thanks for that. I should have been more specific was referring to - being used as both as per pg 15 Eloquent JavaScript. “The minus operator can be used both as
a binary operator and as a unary operator.”
console.log(- (10 - 2))
// → -8

1 Like

Ah, yes! I hadn’t thought of that… :+1:
I just meant the “double minus” decrement operator -- when referring to unary operators, but you’re right… and I should update my little summary to:

-   // binary subtraction operator  AND  unary negation operator
--  // unary decrement operator

+   // binary addition operator  AND  unary plus operator
++  // unary increment operator

:crazy_face: …it just never ends does it?.. :sweat_smile:
It’s all here in its full glory, in the MDN web docs

2 Likes

What are operators?

  • The + and * symbols are called operators—the first stands for addition, and the second stands for multiplication. Putting an operator between two values will apply it to those values and produce a new value.
  • For subtraction, there is the - operator and division that can be done with the / operator.

What binary operators do you know?

  • Binary operators for arithmetic are (+, -, *, /, and %).

What logical operators do you know?

  • JavaScript supports three logical operators: and, or, and not. These can be used to “reason” about Booleans.
  • 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.

console.log(true && false)

// → false

console.log(true && true)

// → true

  • The || operator denotes logical or. It produces true if either of the values given to it is true.

console.log(false || true)

// → true

console.log(false || false)

// → false

  • Not is written as an exclamation mark (!). It is a unary operator that flips the value given to it—!true produces false, and !false gives true.
1 Like
  1. What are operators? The > and < signs are the traditional symbols for “is greater than” and “is
    less than”, respectively. They are binary operators.

  2. What binary operators do you know? < >

  3. What logical operators do you know? and, or, and not.

1 Like

Hi @Jaysun,

Yes, that’s correct…but there are many more operators than just these comparison operators. In general, operators perform different actions on values.

  1. What are operators?
  • An operator is a symbol that operates on a value or a variable
  1. What binary operators do you know?
  • <, >
  1. What logical operators do you know?
  • &&, ||, !
1 Like

What are operators?
Operators are symbols used to express and interaction between two or more values

What binary operators do you know?

  • //Add
  • //Subtract
    / //Divided by
  • //Multiple
    % //Modulo

What logical operators do you know?
&& and
|| or

1 Like
  1. Operators are symbols or words that interact with values in a function.
  2. Binary operators:
    arithmetic + , - , *, / , %
    string concatenation +
    comparison == , != , === , !== , < , > , <= , >=
    logic && , ||
  3. logical operators :* && , ||, !, conditional operator ? :
1 Like
  1. Operators are terms that manipulate values to a desired, hopefully, outcome.
  2. String, Arithmetic, Comparison.
  3. “And, Or, Not”
1 Like

1 - What are operators?

Operators are the symbols between values that allow different operations like addition, subtraction, multiplication, and more.

	A
	JavaScript Logical Operators:

	Operator	Description
	&&			logical and
	||			logical or
	!			logical not


	B
	JavaScript Arithmetic Operators:

	Operator	Description
	+			Addition
	-			Subtraction
	*			Multiplication
	**			Exponentiation (ES2016)
	/			Division
	%			Modulus (Division Remainder)
	++			Increment
	--			Decrement


	C
	JavaScript String Operators:

	Operator	Description
	+ 			concatenate strings


	D
	JavaScript Bitwise Operators:

	Operator	Description	
	&			AND	5 & 1	
	|			OR	5 | 1	
	~			NOT	~ 5	 	
	^			XOR	5 ^ 1	
	<<			Zero fill left shift	
	>>			Signed right shift		
	>>>			Zero fill right shift	



	E
	JavaScript Comparison Operators:

	Operator	Description
	==			equal to
	===			equal value and equal type
	!=			not equal
	!==			not equal value or not equal type
	>			greater than
	<			less than
	>=			greater than or equal to
	<=			less than or equal to
	?			ternary operator


	F
	JavaScript Assignment Operators:

	Operator	Use				Equivalent
	=			x = y			x = y
	+=			x += y			x = x + y
	-=			x -= y			x = x - y
	*=			x *= y			x = x * y
	/=			x /= y			x = x / y
	%=			x %= y			x = x % y
	**=			x **= y			x = x ** y


	G
	JavaScript Type Operators:

	Operator	Description
	typeof		Returns the type of a variable
	instanceof	Returns true if an object is an instance of an object type

2 - What binary operators do you know?

Binary operators are the operators that use two objects like +, -, /, *, <, >, !=, etc.. 

	ex: 1 + 2 

3 - What logical operators do you know?

	A
	JavaScript Logical Operators:

	Operator	Description
	&&			logical and
	||			logical or
	!			logical not
2 Likes