Skip to content

Commit 3784484

Browse files
John Fordsreid
authored andcommitted
Moved hashrockets to newlines
Also fixed a typo
1 parent 4f5616b commit 3784484

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

chapters/arrays/filtering-arrays.textile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ Array::filter = (callback) ->
2020
array = [1..10]
2121

2222
# Filter odd elements
23-
filtered_array = array.filter (x) -> x % 3 == 0 # => [2,4,6,8,10]
23+
filtered_array = array.filter (x) -> x % 2 == 0
24+
# => [2,4,6,8,10]
2425

2526
# Filter elements less than or equal to 5:
2627
gt_five = (x) -> x > 5
27-
filtered_array = array.filter gt_five # => [6,7,8,9,10]
28+
filtered_array = array.filter gt_five
29+
# => [6,7,8,9,10]
2830
{% endhighlight %}
2931

3032
h2. Discussion

0 commit comments

Comments
 (0)