The != operator is an equality operator that is used to check whether two operands are equal or not. The =! operator is a combination of two operators, one is an assignment, and the second is a negation operator that works on boolean value.
A!= B means " A is not equal to B ". A=! B means "Assign the complement of B to A , and yield the lvalue of A ".
=+ does nothing; it's the same as = here. You have just written sum1 = two . sum2 += one on the other hand is essentially the same as sum2 = sum2 + one .
== === = in JavaScript is used for assigning values to a variable. == in JavaScript is used for comparing two variables, but it ignores the datatype of variable. === is used for comparing two variables, but this operator also checks datatype and compares two values.
The question is just playing with you with confusing spacing.
b != b
is the usual !=
(not equals) comparison.
On the other hand:
b =! b
is better written as b = !b
which is parsed as:
b = (!b)
Thus it's two operators.
b
.b
.The assignment operator returns the assigned value. Therefore, (b =! b)
evaluates to true - which is what you print out.
b != b
means ! (b == b)
: the opposite of b == b
.
b =! b
is actually b = !b
, an assignment. It's toggling b
's value. An assignment evaluates to the value of the expression, so this will evaluate to !b
(along with having changed the value of b
).
b=!b
is an assignment. It assigns b
to !b
and the expression evaluates to the resulting value, which is true
.
b =! b
you are doing an assignment, you are saying that B should have the value of !B.
b != b
You are asking if B is different than b
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With