You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: entries/jQuery.inArray.xml
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,9 @@
16
16
<desc>Search for a specified value within an array and return its index (or -1 if not found).</desc>
17
17
<longdesc>
18
18
<p>The <code>$.inArray()</code> method is similar to JavaScript's native <code>.indexOf()</code> method in that it returns -1 when it doesn't find a match. If the first element within the array matches <code>value</code>, <code>$.inArray()</code> returns 0.</p>
19
-
<p>Because JavaScript treats 0 as loosely equal to false (i.e. 0 == false, but 0 !== false), if we're checking for the presence of <code>value</code> within <code>array</code>, we need to check if it's not equal to (or greater than) -1.</p>
19
+
<p>Because JavaScript treats 0 as loosely equal to false (i.e. 0 == false, but 0 !== false), to check for the presence of <code>value</code> within <code>array</code>, you need to check if it's not equal to (or greater than) -1.</p>
20
+
<p>The comparison between values is strict. The following will return <code>-1</code> (not found) because a number is being searched in an array of strings:</p>
0 commit comments