1
2
3
4
5
6
7
8
9
10
To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to CodePen.
0,1,2,3,4,5,6,7,8,9
0
0
0
0
The name of the promise is prom. Fill in the blank. | __________________________________________________ let request = new XMLHttpRequest(); request.open('GET', "slow-loris.html"); request.onload = function() { if (request.status == 200) { resolve(request.response); } else { reject("File not Found"); } }; request.send(); }); |
const prom = new Promise(function(resolve, reject) { | constprom=newPromise\(function\(resolve,reject\){ |
Fill in the blank. | const prom = new Promise(function(resolve, reject) { const prom = new Promise(function(resolve, reject) { let request = new XMLHttpRequest(); request.open('GET', "slow-loris.html"); _____________________________ if (request.status == 200) { resolve(request.response); } else { reject("File not Found"); } }; request.send(); }); |
request.onload = function() { | request\.onload=function\(\){ |
Fill in the blank. | const prom = new Promise(function(resolve, reject) { const prom = new Promise(function(resolve, reject) { let request = new XMLHttpRequest(); request.open('GET', "slow-loris.html"); request.onload = function() { ___________________________ resolve(request.response); } else { reject("File not Found"); } }; request.send(); }); |
if (request.status == 200) { | if\(request\.status==200\){ |
Fill in the blank. | const prom = new Promise(function(resolve, reject) { let request = new XMLHttpRequest(); request.open('GET', "slow-loris.html"); request.onload = function() { if (request.status == 200) { _________________ } else { reject("File not Found"); } }; request.send(); }); |
resolve(request.response); | resolve\(request\.response\); |
Fill in the blank. Make up the error text. | const prom = new Promise(function(resolve, reject) { let request = new XMLHttpRequest(); request.open('GET', "slow-loris.html"); request.onload = function() { if (request.status == 200) { resolve(request.response); } else { ________________ } }; request.send(); }); |
reject("File not Found"); | reject\(•.*•\); |
Fill in the blank. | _________________________________ display(fileContent); }).catch(function(errorText) { display(errorText); }); |
prom.then(function(fileContent) { | prom\.then\(function\(fileContent\){ |
Fill in the blank. | prom.then(function(fileContent) { display(fileContent); _________________________________ display(errorText); }); |
}).catch(function(errorText) { | }\)\.catch\(function\(errorText\){ |
Fill in the blank. The function that's being called is display() | prom.then(function(fileContent) { display(fileContent); }).catch(function(errorText) { ________________ }); |
display(errorText); | display\(errorText\); |
|
|||
|