Skip to content

Commit 156087a

Browse files
committed
Get rid of == reference, add note in === ref
1 parent e407579 commit 156087a

File tree

1 file changed

+5
-30
lines changed

1 file changed

+5
-30
lines changed

src/core/reference.js

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -56,45 +56,20 @@
5656
* @submodule Comparison Operators
5757
*/
5858

59-
/**
60-
* The equality operator <a href="#/p5/==">==</a>
61-
* checks to see if two values are equal.
62-
*
63-
* Unlike, the strict equality operator, <a href="#/p5/===">===</a>, if
64-
* the values being compared are not already the same type they will be
65-
* converted to the same type before comparison.
66-
*
67-
* A comparison expression always evaluates to a <a href="#/p5/boolean">boolean</a>.
68-
*
69-
* From <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators">the MDN entry</a>:
70-
* The equality operator converts the operands if they are not of the same type, then applies strict comparison.
71-
* If both operands are objects, then JavaScript compares internal references which are equal when operands refer
72-
* to the same object in memory.
73-
*
74-
* @property ==
75-
*
76-
* @example
77-
* <div class='norender'>
78-
* <code>
79-
* console.log(1 == 1); // prints true to the console
80-
* console.log('1' == 1); // prints true to the console
81-
* </code>
82-
* </div>
83-
*/
84-
8559
/**
8660
* The strict equality operator <a href="#/p5/===">===</a>
8761
* checks to see if two values are equal and of the same type.
8862
*
89-
* Unlike, the equality operator, <a href="#/p5/==">==</a>,
90-
* regardless of whether they are different types
91-
* the values being compared are not converted before comparison.
92-
*
9363
* A comparison expression always evaluates to a <a href="#/p5/boolean">boolean</a>.
9464
*
9565
* From <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators">the MDN entry</a>:
9666
* The non-identity operator returns true if the operands are not equal and/or not of the same type.
9767
*
68+
* Note: In some examples around the web you may see a double-equals-sign
69+
* <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators#Equality">==</a>,
70+
* used for comparison instead. This is the non-strict equality operator in Javascript.
71+
* This will convert the two values being compared to the same type before comparing them.
72+
*
9873
* @property ===
9974
*
10075
* @example

0 commit comments

Comments
 (0)