DEV Community

Kuhanraja A R
Kuhanraja A R

Posted on

javascript fundamentals -2

welcome to my blog

in javascript no++ means no+=1;

no = 5;
no = no * 5; (no*=5)

Comparison operator:
Comparison operators are used in logical statements to determine equality or difference between variables or values.
Types of comparison operator:
`== (equal value)
=== (equal type)
!= (not equal)
!==(not equal type and equal value)

(greater than)
< (less than)
= (greater than equal to)
<= (less than equal to)`

double(==):
15 == 5 (true)
"10" == 10 (true) --> Dynamic typing

(triple ===):
Strictly checks the datatype too..
"10"===10 -->false

Not operator and Not equal operator
10!=10 --> false
10!="10" --> false
10!=="10" --> True.

Does Javascript supports dynamic typing in less than and greater than operator

Yes, JavaScript supports < (less than) and > (greater than) in dynamic typing — meaning you can compare variables of different types (like numbers, strings, booleans, etc.

(greater than >)
(less than <)
(greater than equal to >=)
(less than equal to <=)

`10 < 5 --> false
10 < 10 --> false
10 > 10 --> false
10 <= 10 --> True
11 > 10 --> True
11 >= 10 --> True
"11" >= 10 --> True

no = 10
(no++ > 10) --> false
(10 > 10)`

because it doesnot increment it displays the same number given and increment the number in the memory.

(++no > 10) --> True
(11 > 10)

In this case it is pre increment operator. It displays the incremented number at the first.

Logical AND and Logical OR.
condition 1 && condition 2 --> It is the operator for AND operator..

condition 1 || condition 2 --> It is the operator for OR operator..

In AND operator The condition passes when both the condition is true.

In OR operator The condition passes when either one of the condition is true

ex

no = 10
(no ++ > 10 && --no < 15)

result : False

Enter fullscreen mode Exit fullscreen mode

Ans is 11. This is why because,the first compared value is false. So, it takes 1st value itself. The first condition itself false in the AND operator. So, it doesn't check the another condition..

Top comments (0)