Using GET requests in JavaScript

Let there be some object on a server:

let obj = {1: 'a', 2: 'b', 3: 'c'}; export default function({get}) { }

Let's make three links that send GET parameters to the server:

<a href="/handler/?key=1">1</a> <a href="/handler/?key=2">2</a> <a href="/handler/?key=3">3</a>

Now we will correct the server code so that following the link shows the corresponding object element:

export default { '/handler/': function({get}) { let obj = {1: 'a', 2: 'b', 3: 'c'}; return obj[get.key]; } }

Let a server have an array with users:

let arr = [ 'user1', 'user2', 'user3' ];

Make links that show relevant users in the browser.

Modify the previous task so that if there is no element in the array with the passed key, an error is sent to the browser.