Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8346b54

Browse files
authored
URLSearchParams snippet
1 parentbf89592 commit8346b54

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

‎README.md‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,22 @@ const user = {
196196
const { education : { degree } }
197197
console.log(degree) //Masters
198198
```
199+
200+
# URLSearchParams
201+
202+
203+
```javascript
204+
//The URLSearchParams interface defines utility methods to work with the query string of a URL.
205+
206+
const urlParams = new URLSearchParams("?post=1234&action=edit");
207+
208+
console.log(urlParams.has('post')); // true
209+
console.log(urlParams.get('action')); // "edit"
210+
console.log(urlParams.getAll('action')); // ["edit"]
211+
console.log(urlParams.toString()); // "?post=1234&action=edit"
212+
console.log(urlParams.append('active','1')); // "?post=1234&action=edit&active=1"
213+
```
214+
215+
216+
217+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp