Advertisement
lukaszbartoszek1

Untitled

Sep 12th, 2019
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const printWithDelay = async (text: string) => {
  2.     return new Promise(resolve => setTimeout(() => {
  3.         document.write(`${text}<br>`);
  4.         resolve()
  5.     }, Math.random() * 1000))
  6. };
  7.  
  8. const texts = [
  9.   '1. I am first!',
  10.   '2. I am second!',
  11.   '3. I am in the middle!',
  12.   '4. I am fourth!',
  13.   '5. I am the last one :('
  14. ];
  15.  
  16. const printTableValues = async (input: string[]) => {
  17.     // Your code goes here
  18. }
  19.  
  20. (async () => {
  21.     try {
  22.         await printTableValues(texts);
  23.         document.write(`Printing done!`);
  24.     } catch (err) {
  25.         document.write(`Printing failed! Error details:<br>${err}`);
  26.     }
  27. })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement