Let's start with pemdas rule of operator precedence
Pemdas consists of Parentheses, Exponents, Multiplication and Division , Addition and Subtraction.
All performed left to right,as you write English,hindi and coding,all are performed and written left to right.
We will capable to remember this by formula "pemdas comparison logically".
You are familiar with the BODMAS rule of the mathematics which assists javascript to decide for operator precedence.
B deside the order ( ), { }, [ ] which will resolve first and of play with power and exponents.
D / M accomplished the left to right,
A / M- Addition and Subtraction achieved left to right.
We have covered Arithmetic operators (+, -, *, /, %) in terms of formula, which will be helpful, when you solve a problem of any programming languages and operators are same on every language.
Comparison operators (==, ===, !=, >, <)
The main difference between == and === .
== accomplishes type coercion (type conversion) ,when comparing values(let's compare notes , from the decorated office | space is true or false, how is ambience, it is just identical to the comparision operators), so values of different types may be considered equal after coercion. For example, 0 == false is true, "" == false is true,''=='' is true, and null == undefined is true. These are the famous bugs of javascript, people love these bugs and left them in JavaScript to make js backword compatible.
The === operator tests stringent(strict) equality: it only returns true if both value and type are exactly the same, with no type coercion. For example, "" === false is false.
The best practice recommends to influence yourself to leverage three-character operator === and !==). the reason when you want the types match.
The === strict comparision operator doesn't perform the type coercion when compared, and compare arrays, functions, you will obtain the comparsion with help of their refernce.
Reference vs. Value: array1 == array2 checks if they are the same instance (reference), not if they have the same elements.
Memory Location: If two different arrays contain the same values, == will return false.

, < why they are made, money > respect or money < respect , we will use this example to make you understand, why these are leveraged and these logical operators deliver the boolean value.
Logical operators (&&, ||, !)
These concepts orignated from the digital electronics and these are backbone of computer science
What does the Logical AND (&&) operator do?
Answer: It evaluates operands from left to right,just similar to moving left to right, returning the first falsy value it encounters. If all operands are truthy, it returns the last value.
Example: console.log(" " && true && 10); // Returns 10
What are the truthy and falsy values in JavaScript?
Falsy Values are converted to zero / false ,when you are performing any logical operation.
for example-
false (the Boolean value itself)
0, -0, and 0n (the number zero, negative zero, and BigInt zero)
"", '',
(an empty string)
null
undefined
NaN (Not a Number)
document.all (a legacy, deprecated object used for backward compatibility)
||- denoted as logical or operator and It returns the fist of two operands that is true.If the leftmost value is true, it returns that; otherwise, it returns the second value.It is often used to set default values.
console.log(null || "Hello");
Short-circuiting: It stops evaluation as soon as it finds the first truthy value.
Example: -> result will be "Hello" because null is a falsy value.
Default value: let name = userInput || "Guest"; (If userInput is empty/undefined, "Guest" will be set).
Truthy vs. Falsy Values:
In JavaScript, false, 0, "" (empty string), null, undefined, and NaN are considered 'falsy', while everything else is 'truthy'.
Assignment operators (=, +=, -=)
Consider assignment is delegation a value or operation to a different variable.
apple=mango(Now apple and mango tastes similar sweet) ,
iceAge+=PipinghotEra is shortcut for iceAge=iceAge+PipinghotEra
,-=(it is also written similarly).


Top comments (0)