Skip to content

Commit 7625fb2

Browse files
DarrenRiedlingerscottgonzalez
authored andcommitted
Reverted "can't" to "don't have to".
Commit 9d45ae2 introduced an incorrect statement, stating that the object being iterated upon by $.each can't be accessed inside the each function. Reverted these two occurrences in the documentation to their state pre-9d45ae2.
1 parent 43ceab0 commit 7625fb2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

page/using-jquery-core/iterating.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ $.each( arr, function( index, value ){
3636
console.log( sum ); // 15
3737
```
3838

39-
Notice that `arr[ index ]` can't be accessed as the value is conveniently passed to the callback in `$.each()`. In addition, given:
39+
Notice that we don't have to access `arr[ index ]` as the value is conveniently passed to the callback in `$.each()`.
40+
41+
In addition, given:
4042

4143
```
4244
var sum = 0;
@@ -67,7 +69,9 @@ $.each( obj, function( key, value ) {
6769
console.log( sum ); // 3
6870
```
6971

70-
Again, `obj[ key ]` is passed directly to the callback and thus can't be accessed. Note that `$.each()` is for plain objects, arrays, array-like objects *that are not jQuery collections*.
72+
Again, we don't have to directly access `obj[ key ]` as the value is passed directly to the callback.
73+
74+
Note that `$.each()` is for plain objects, arrays, array-like objects *that are not jQuery collections*.
7175

7276
This would be considered incorrect:
7377

0 commit comments

Comments
 (0)