// GET Request.
fetch('https://api.github.com/users/rich-harris')
// Handle success
.then(response => response.json()) // convert to json
.then(json => console.log(json)) // print data to console
.catch(err => console.log('Request Failed', err)); // Catch errors
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter