Skip to content

Commit 27204d5

Browse files
committed
Add comparison operator references
1 parent 01719e4 commit 27204d5

File tree

1 file changed

+130
-0
lines changed

1 file changed

+130
-0
lines changed

src/core/reference.js

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,136 @@
5252
* </div>
5353
*/
5454

55+
/**
56+
* @submodule Comparison Operators
57+
*/
58+
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+
85+
/**
86+
* The strict equality operator <a href="#/p5/===">===</a>
87+
* checks to see if two values are equal and of the same type.
88+
*
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+
*
93+
* A comparison expression always evaluates to a <a href="#/p5/boolean">boolean</a>.
94+
*
95+
* From <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators">the MDN entry</a>:
96+
* The non-identity operator returns true if the operands are not equal and/or not of the same type.
97+
*
98+
* @property ===
99+
*
100+
* @example
101+
* <div class='norender'>
102+
* <code>
103+
* console.log(1 == 1) // prints true to the console
104+
* console.log(1 == '1'); // prints false to the console
105+
* </code>
106+
* </div>
107+
*/
108+
109+
/**
110+
* The greater than operator <a href="#/p5/>">></a>
111+
* evaluates to true if the left value is greater than
112+
* the right value.
113+
*
114+
*
115+
* <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators">There is more info on comparison operators on MDN.</a>
116+
*
117+
* @property >
118+
*
119+
* @example
120+
* <div class='norender'>
121+
* <code>
122+
* console.log(100 > 1) // prints true to the console
123+
* console.log(1 > 100); // prints false to the console
124+
* </code>
125+
* </div>
126+
*/
127+
128+
/**
129+
* The greater than or equal to operator <a href="#/p5/>=">>=</a>
130+
* evaluates to true if the left value is greater than or equal to
131+
* the right value.
132+
*
133+
*
134+
* <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators">There is more info on comparison operators on MDN.</a>
135+
*
136+
* @property >=
137+
*
138+
* @example
139+
* <div class='norender'>
140+
* <code>
141+
* console.log(100 >= 100) // prints true to the console
142+
* console.log(101 >= 100); // prints true to the console
143+
* </code>
144+
* </div>
145+
*/
146+
147+
/**
148+
* The less than operator <a href="#/p5/<"><</a>
149+
* evaluates to true if the left value is less than
150+
* the right value.
151+
*
152+
*
153+
* <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators">There is more info on comparison operators on MDN.</a>
154+
*
155+
* @property <
156+
*
157+
* @example
158+
* <div class='norender'>
159+
* <code>
160+
* console.log(1 < 100) // prints true to the console
161+
* console.log(100 < 99); // prints false to the console
162+
* </code>
163+
* </div>
164+
*/
165+
166+
/**
167+
* The less than or equal to operator <a href="#/p5/<="><=</a>
168+
* evaluates to true if the left value is less than or equal to
169+
* the right value.
170+
*
171+
*
172+
* <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators">There is more info on comparison operators on MDN.</a>
173+
*
174+
* @property <=
175+
*
176+
* @example
177+
* <div class='norender'>
178+
* <code>
179+
* console.log(100 <= 100) // prints true to the console
180+
* console.log(99 <= 100); // prints true to the console
181+
* </code>
182+
* </div>
183+
*/
184+
55185
/**
56186
* @submodule Control Statement
57187
*/

0 commit comments

Comments
 (0)