回答編集履歴

3

\[\]\.concatは不要だった

2017/01/31 08:15

投稿

turbgraphics200
turbgraphics200

スコア4267

test CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  let arr = [...Array(11).keys()]; // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
8
8
 
9
- let result = [].concat(arr.filter(v => v >= threshold), arr.filter(v => v < threshold));
9
+ let result = arr.filter(v => v >= threshold).concat(arr.filter(v => v < threshold)));
10
10
 
11
11
  console.log(result);
12
12
 

2

10が抜けてた

2017/01/31 08:15

投稿

turbgraphics200
turbgraphics200

スコア4267

test CHANGED
@@ -10,6 +10,6 @@
10
10
 
11
11
  console.log(result);
12
12
 
13
- // [4, 5, 6, 7, 8, 9, 0, 1, 2, 3]
13
+ // [4, 5, 6, 7, 8, 9, 10, 0, 1, 2, 3]
14
14
 
15
15
  ```

1

ES6に

2017/01/31 08:13

投稿

turbgraphics200
turbgraphics200

スコア4267

test CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  ```js
4
4
 
5
- var threshold = 4;
5
+ const threshold = 4;
6
6
 
7
- var arr = [...Array(11).keys()]; // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
7
+ let arr = [...Array(11).keys()]; // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
8
8
 
9
- var result = [].concat(arr.filter(v => v >= threshold), arr.filter(v => v < threshold));
9
+ let result = [].concat(arr.filter(v => v >= threshold), arr.filter(v => v < threshold));
10
10
 
11
11
  console.log(result);
12
12