✪ Logical 'not' operator has "lower precedence" than Comparison Operators (here '==') and Identity Operators (here 'is not').
✪ Comparison Operators and Identity Operators have same precedence.
2️⃣ Operator Associativity
✪ Associativity is the order in which an expression is evaluated that has "multiple operators of the same precedence".
✪ Almost all the operators have left-to-right associativity (well almost, but not all).
Example:
5 * 4 // 3
✪ Here * and // have equal precedence. And they have left to right associativity.
So,
5 * 4 // 3 ⇨ (5 * 4) // 3 ⇨ 20 // 3 ⇨ 6
2️⃣.1️⃣ Operator Associativity for Comparison and Identity Operators
When I said, "almost all the operators have left-to-right associativity", that "almost" doesn't include Comparison, Identity and Membership operators.
So, are they right to left associative? No.
Then?
They are not associative at all. Huhhh...
Then, how do they get evaluated?
Example:
→ x < y < z
It is evaluated as
→ (x < y) and (y < z)
Cool 😎
3️⃣ Let's work
Our Original expression is
→ not False == True is not True == True
Here
✪ '==' , 'is not' and '==' all have equal precedence
✪ 'not' has the lowest precedence
not False == True is not True == True
⇩
not (False == True is not True == True)
⇩
not ((False == True) and (True is not True) and (True == True))
⇩
not (((False == True) and (True is not True)) and (True == True)) ['and' and 'and' are left to right associativity]
⇩
not (((False) and (False)) and (True))
⇩
not ((False and False) and True)
⇩
not (False and True)
⇩
not (False)
⇩
True
Hope, you found it interesting yet, easy to solve.
1️⃣ Introduction
2️⃣ JSX
3️⃣ Virtual DOM
4️⃣ Component
5️⃣ States and Props
6️⃣ Data Binding
7️⃣ Component Rendering
8️⃣ Hooks Introduction
1️⃣ Introduction
✪ What is React?
✪ What is the current version of React?
✪ What are core features of React?
✪ What are advantages using React?
✪ Where shouldn't we use React?
✪ What is SPA?
✪ When will a SPA run slower/faster?
1️⃣ Data Types
2️⃣ Boolean
3️⃣ Number
4️⃣ Logical Operators
5️⃣ Comparison Operators
6️⃣ Arithmetic Operators
1️⃣ Data Types
✪ What all data types does JavaScript provide?
✪ How to find out data type of a value? (which operator to use)
✪ What is type coercion?
✪ Any significant difference between "undefined" and "null"?
✪ What is the type of undefined?
✪ What is the type of null?