Beginner
Build and read search URLs
Write buildSearchUrl(term, page) that returns the full URL https://shop.example.com/search with q set to the term and page set to the page number. Any text must work, even R&D #1.
Write readPage(urlText) that returns the page parameter as a number, or 1 when it's missing or not a positive whole number.
What Check tests
buildSearchUrl("red shoes", 2)points to /search with q and page- Special characters survive:
R&D #1 readPagereadspage=4as the number 4readPagereturns 1 when page is missingreadPagereturns 1 forpage=abcorpage=-2
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.