Last active
November 11, 2022 01:08
-
-
Save Xilesun/7606d2ec03e9d084dbfbae21c0d7e2c0 to your computer and use it in GitHub Desktop.
rainforest QA problem solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function get(url) { | |
urlArr = url.split('?'); | |
url = `${urlArr[0]}.json?${urlArr[1] || ''}` | |
const res = await fetch(url, { | |
method: 'GET', | |
headers: { | |
'Content-Type': 'application/json', | |
}, | |
mode: 'cors' | |
}); | |
return await res.json(); | |
} | |
(async function() { | |
let data = await get('https://www.letsrevolutionizetesting.com/challenge') | |
while (data.message === 'This is not the end') { | |
data = await get(data.follow); | |
} | |
console.log(data); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment