質問編集履歴

1

正規表現が正しくなかったので修正しました。

2019/08/28 01:33

投稿

Web_akira
Web_akira

スコア34

test CHANGED
File without changes
test CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  const str = "apple,banana,orange";
8
8
 
9
- const replaced = str.replace(/,/, ' ')
9
+ const replaced = str.replace(/,/g, ' ')
10
10
 
11
11
  console.log(replaced) // apple banana orange
12
12