JavaScript에서 encodeURIComponent() 함수를 사용하는 이유는?
보통 MDN Web Docs해설
encodeURIComponent('검색어 test&type=1')는 '%EA%B2%80%EC%83%89%EC%96%B4%20test%26type%3D1'처럼 변환합니다. URL의 쿼리 파라미터에 특수 문자가 포함될 때 의미가 훼손되지 않도록 퍼센트 인코딩합니다.
encodeURIComponent('검색어 test&type=1')는 '%EA%B2%80%EC%83%89%EC%96%B4%20test%26type%3D1'처럼 변환합니다. URL의 쿼리 파라미터에 특수 문자가 포함될 때 의미가 훼손되지 않도록 퍼센트 인코딩합니다.