Skip to content

Commit 672cc7f

Browse files
committed
Added exercise 18.1 solution
1 parent d9f9f22 commit 672cc7f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const url = 'https://eloquentjavascript.net/author';
2+
const types = ['text/plain', 'text/html', 'application/json', 'application/rainbows+unicorns'];
3+
4+
async function showTypes() {
5+
for (let type of types) {
6+
let resp = await fetch(url, { headers: { accept: type } });
7+
console.log(`${type}: ${await resp.text()}\n`);
8+
}
9+
}
10+
11+
showTypes();

0 commit comments

Comments
 (0)