回答編集履歴

2

constに変更

2020/01/15 03:31

投稿

shiracamus
shiracamus

スコア5406

test CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  {
10
10
 
11
- let newArray = [...array]
11
+ const newArray = [...array]
12
12
 
13
13
  delete newArray[index]
14
14
 

1

閉じ括弧表示追加

2020/01/15 03:31

投稿

shiracamus
shiracamus

スコア5406

test CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  let newArray = [...array]
12
12
 
13
- newArray[index] = undefined
13
+ delete newArray[index]
14
14
 
15
15
  return newArray
16
16
 
@@ -25,6 +25,8 @@
25
25
  console.log(`array(${array.filter(v => v !== undefined).length}) {`)
26
26
 
27
27
  array.forEach((v, i) => v !== undefined && console.log(` [${i}]=>\n ${v}`))
28
+
29
+ console.log('}')
28
30
 
29
31
  }
30
32