Course Hero Logo
This textbook is available Logo
JavaScript: The Web Warrior Series 6th Edition

JavaScript: The Web Warrior Series (6th Edition)

Book Edition6th Edition
SubjectComputer Science
Chapter 9, Understanding State Information, Short Quiz, Exercise 1
Page 634

How do you reference a passed query string in your code?


The query string portion of the URL (Uniform Resource Locator) of the web page consists of a set of name-value pairs representing the search parameters. It is stored in the search property of the Location object. The query string starts with the question mark which can be removed using the length property and substring() method of the String object. The name-value pairs are separated by ampersand (&). Each and every name-value pair can be extracted by calling the split() method of String object and passing '&' as parameter.  

Verified Answer

The passed query string is referenced using the search property of the Location object and parsed using the length property and substring() and split() methods of the String object.

How would you rate this answer and explanation?
Did you like this example?
Subscribe for full access
Page 634