Skip to content

Commit 56231d3

Browse files
committed
fix bug with array index
1 parent 55316d0 commit 56231d3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

chapters/arrays/removing-duplicate-elements-from-arrays.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ You want to remove duplicate elements from an array.
1212
{% highlight coffeescript %}
1313
Array::unique = ->
1414
output = {}
15-
output[@[key]] = @[key] for key in [1...@length]
15+
output[@[key]] = @[key] for key in [0...@length]
1616
value for key, value of output
1717

1818
[1,1,2,2,2,3,4,5,6,6,6,"a","a","b","d","b","c"].unique()

0 commit comments

Comments
 (0)