回答編集履歴

1

調整

2023/07/07 02:11

投稿

yambejp
yambejp

スコア116468

test CHANGED
@@ -1,6 +1,6 @@
1
1
  ```javascript
2
2
  const txt="piyo1=hoge1,piyo2=hoge2,piyo3=hoge3";
3
- const usp=new URLSearchParams(`?${txt.replace(/,/g,'&')}`);
3
+ const usp=new URLSearchParams(txt.replace(/,/g,'&'));
4
4
  const result=JSON.stringify(Object.fromEntries([...usp.entries()]));
5
5
  console.log(result);
6
6
  ```