1console.log ('Starting');
2let image;
3
4fetch('coffee.jpg').then((response) => {
5 console.log('It worked :)')
6 return response.blob();
7}).then((myBlob) => {
8 let objectURL = URL.createObjectURL(myBlob);
9 image = document.createElement('img');
10 image.src = objectURL;
11 document.body.appendChild(image);
12}).catch((error) => {
13 console.log('There has been a problem with your fetch operation: ' + error.message);
14});
15
16console.log ('All done!');
1const printProcess = () => {
2 console.log('it will print 2nd');
3 var currentTime = new Date().getTime();
4 while (currentTime + 3000 >= new Date().getTime());
5 console.log('it will print after added 3 second with current time')
6}
7
8console.log('it will print 1st ');
9printProcess(); //follow arrow funtion after 1st print
10console.log('it will print at the end');
11//Expected output below:
12// it will print 1st
13// it will print 2nd
14// it will print after added 3 second with current time
15// it will print at the end