Continuing the discussion from freeCodeCamp Challenge Guide: Seek and Destroy:
Is used to negate the result of the function. In other words, if the function returns true
, the β!β symbol negates the result to false
, and if the function returns false
, the β!β symbol negates the result to true
. This is useful when you want to reverse the outcome of the function, making it return the opposite value of what it would have returned without the β!β symbol.
Googling is P0 skill which every developer should learn and continue to learn.
Google βWhat does β!β mean in CSSβ, also there are some nice FCC videos on how to use google effectively, please go through it and take notes.
@bidung610
β!β is a logical operator in javascricpt known as the logical Not operarator sometimes colloqually called the βbangβ operator.
It is used mostly to negate a boolean value especially in the if statements code blocks,
It returns the negative ot oposite of the value
It can also be used with the comparison operator to show that a value is not equal to the othe
a !== b;
meaning a is not equal to b,in which case if ais not equal to b it returns true if not it returns false
Hope it helps
It is a boolean operator, one of a set that let you make logical comparisons between values. Using them will produce true
or false
as a result of the comparison.
!
is NOT&&
is AND||
is OR===
is EQUAL TO>
is GREATER THAN<
is LESS THAN
!
is the only one that can be unary, ie it can apply to a single value.
!
, >
, <
and ===
can be combined:
!==
is NOT EQUAL TO>=
is GREATER THAN OR EQUAL TO<=
is LESS THAN OR EQUAL TO
This should be fairly self explanatory when you read it.
For example if you have the values 1
and 2
assigned to the variables x
and y
:
!x
NOT x
NOT 1
1 is 1, so this is a false statement.
x > y
x IS GREATER THAN y
1 IS GREATER THAN 2
That statement is also false.
x !== y
x IS NOT EQUAL TO y
1 IS NOT EQUAL TO 2
That statement is true.
thank you very much for your support.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.