minor fixes
This commit is contained in:
parent
b057341f6c
commit
c2ce2d4cbd
1 changed files with 8 additions and 4 deletions
|
@ -1,15 +1,19 @@
|
||||||
# Comparisons
|
# Comparisons
|
||||||
|
|
||||||
We know many comparison operators from maths:
|
We know many comparison operators from maths.
|
||||||
|
|
||||||
|
In JavaScript they are written like this:
|
||||||
|
|
||||||
- Greater/less than: <code>a > b</code>, <code>a < b</code>.
|
- Greater/less than: <code>a > b</code>, <code>a < b</code>.
|
||||||
- Greater/less than or equals: <code>a >= b</code>, <code>a <= b</code>.
|
- Greater/less than or equals: <code>a >= b</code>, <code>a <= b</code>.
|
||||||
- Equals: `a == b` (please note the double equals sign `=`. A single symbol `a = b` would mean an assignment).
|
- Equals: `a == b`, please note the double equality sign `=` means the equality test, while a single one `a = b` means an assignment.
|
||||||
- Not equals. In maths the notation is <code>≠</code>, but in JavaScript it's written as an assignment with an exclamation sign before it: <code>a != b</code>.
|
- Not equals. In maths the notation is <code>≠</code>, but in JavaScript the it's written as <code>a != b</code>.
|
||||||
|
|
||||||
|
In this article we'll learn more about different types of comparisons, how JavaScript makes them, including important peculiarities.
|
||||||
|
|
||||||
## Boolean is the result
|
## Boolean is the result
|
||||||
|
|
||||||
Like all other operators, a comparison returns a value. In this case, the value is a boolean.
|
All comparison operators return a boolean value:
|
||||||
|
|
||||||
- `true` -- means "yes", "correct" or "the truth".
|
- `true` -- means "yes", "correct" or "the truth".
|
||||||
- `false` -- means "no", "wrong" or "not the truth".
|
- `false` -- means "no", "wrong" or "not the truth".
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue