1
2
3async function fancyShowRainbow(){
4 const response = await fetch("rainbow.jpg");
5 const blob = await response.blob();
6 document.querySelector(".my-image").src = URL.createObjectURL(blob);
7}
8
9
10function showRainbow(){
11 fetch("rainbow.jpg")
12 .then(res => {
13 console.log(res);
14 return res.blob();
15 })
16 .then(blob => {
17 document.querySelector(".my-image").src = URL.createObjectURL(blob);
18 console.log(blob);
19 })
20 .catch(error => {
21 console.log("ERROR!!");
22 console.error(error);
23 });
24}
25
26
27