parent
693047d5c6
commit
ab4367a751
|
@ -6,7 +6,7 @@ challengeType: 1
|
|||
|
||||
## Description
|
||||
<section id='description'>
|
||||
You may recall from <a href="waypoint-comparison-with-the-equality-operator" target="_blank">Comparison with the Equality Operator</a> that all comparison operators return a boolean <code>true</code> or <code>false</code> value.
|
||||
You may recall from <a href="learn/javascript-algorithms-and-data-structures/basic-javascript/comparison-with-the-equality-operator" target="_blank">Comparison with the Equality Operator</a> that all comparison operators return a boolean <code>true</code> or <code>false</code> value.
|
||||
Sometimes people use an if/else statement to do a comparison, like this:
|
||||
<blockquote>function isEqual(a,b) {<br> if (a === b) {<br> return true;<br> } else {<br> return false;<br> }<br>}</blockquote>
|
||||
But there's a better way to do this. Since <code>===</code> returns <code>true</code> or <code>false</code>, we can return the result of the comparison:
|
||||
|
|
Loading…
Reference in New Issue