Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sjfkai committed Feb 15, 2016
1 parent 3423200 commit 1e867fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions _posts/zh_CN/2016-02-06-deduplicate-an-array.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ categories:
- zh_CN
---

# Primitives
如果一个数组至包含原始变量,我们可以使用[`filter`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)[`indexOf`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf)方法将其去重:
# 原始变量
如果一个数组只包含原始变量,我们可以使用[`filter`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)[`indexOf`](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf)方法将其去重:

```javascript
var deduped = [ 1, 1, 'a', 'a' ].filter(function (el, i, arr) {
Expand Down

0 comments on commit 1e867fb

Please sign in to comment.