URLSearchParams location.search 파싱하기

example
1
const getPageNumber = () => new URLSearchParams(location.search).get('p');

example.com/hello/world?p=1

이런 url이 있을 때 param p를 꺼내볼 수 있다

참고

URLSearchParams location.search 파싱하기

https://chinsun9.github.io/2022/01/08/web-api-URLSearchParams/

Author

chinsung

Posted on

2022-01-08

Updated on

2022-01-08

Licensed under

댓글