Complete the code to create a new URL object with the base 'https://example.com'.
const url = new URL([1]);The URL constructor needs a full URL string including the protocol. 'https://example.com' is correct.
Complete the code to add a query parameter 'search' with value 'books' to the URL.
url.searchParams.append([1], 'books');
The query parameter key to add is 'search' as specified.
Fix the error in the code to correctly set the pathname to '/products'.
url.[1] = '/products';
The correct property to set the path part of the URL is 'pathname'.
Fill both blanks to create a URL with base 'https://api.example.com' and add a query parameter 'page' with value '2'.
const url = new URL([1]); url.searchParams.append([2], '2');
The base URL is 'https://api.example.com' and the query parameter key is 'page'.
Fill all three blanks to create a URL with base 'https://shop.com', set pathname to '/items', and add query parameter 'category' with value 'books'.
const url = new URL([1]); url.[2] = '/items'; url.searchParams.append([3], 'books');
The base URL is 'https://shop.com', the pathname property is 'pathname', and the query parameter key is 'category'.