JavaScript Location search Tutorial

In this section, we will learn what the location search property is and how to use it in JavaScript.

JavaScript Location search Property

The `search` property is used to set or get the query string in the URL of the currently loaded page.

This value starts with a question mark.

Note: if there’s no query, the return value will be an empty string.

Location search Property Syntax:

location.search;

location.search = “search”;

Example: using Location search protocol in JavaScript

location.search = "[email protected]";

Leave a Reply