URLSearchParams delete()
delete() 方法刪除與指定鍵匹配的查詢字串中的所有鍵值對。
更多 URLSearchParams 內容參閱 URLSearchParams 物件 一章節。
語法結構:
[JavaScript] 純文字檢視 複製程式碼urlSearchParam.delete(key)
引數解析:
(1).key:必需,查詢字串中要刪除的鍵值對的鍵名。
程式碼例項:
[JavaScript] 純文字檢視 複製程式碼執行程式碼let url = "https://www.softwhy.com/forum.php?mod=viewthread&tid=4596"; let urlSearchParam = new URLSearchParams(url.split("?")[1]); urlSearchParam.delete("mod"); console.log(urlSearchParam.toString()); console.log(urlSearchParam.get("mod"));
程式碼執行效果截圖:
上述程式碼成功刪除 url 查詢字串中的 mod/viewthread。
相關文章
- URLSearchParams delete() 方法delete
- URLSearchParams 物件物件
- URLSearchParams append()APP
- URLSearchParams get()
- URLSearchParams getAll()
- URLSearchParams 物件用法物件
- URLSearchParams set() 方法
- URLSearchParams getAll() 方法
- URLSearchParams get() 方法
- URLSearchParams append() 方法APP
- FormData delete()ORMdelete
- JavaScript deleteJavaScriptdelete
- git delete and revertGitdelete
- MySQL Delete PHPMySqldeletePHP
- Map delete() 方法delete
- WeakMap delete() 方法delete
- WeakSet delete() 方法delete
- SQL__DELETESQLdelete
- Set delete() 方法delete
- JavaScript delete用法JavaScriptdelete
- 使用URLSearchParams處理 fetch 傳送的資料
- 740. Delete and Earndelete
- OUTLOOK - Unable to Delete Meetingsdelete
- jemalloc delete 出現 segmentfaultdelete
- 如何提高MySQL DELETE 速度MySqldelete
- 記憶體(new delete )記憶體delete
- Sanic delete()方法/函式delete函式
- 450-Delete Node in a BSTdelete
- How To Delete Unwanted Boot Menu Itemsdeleteboot
- [20190825]Join View and delete.txtViewdelete
- python--之np.deletePythondelete
- 【SQL】11 SQL DELETE 語句SQLdelete
- sql:delete if exists還是drop if exists?SQLdelete
- 這樣delete居然不走索引delete索引
- 380. Insert Delete GetRandom O (1)deleterandom
- [20200906][轉載]FK on delete.txtdelete
- C malloc() free(), C++ new() delete()C++delete
- Leetcode 237. Delete Node in a Linked ListLeetCodedelete