Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const printWithDelay = async (text: string) => {
- return new Promise(resolve => setTimeout(() => {
- document.write(`${text}<br>`);
- resolve()
- }, Math.random() * 1000))
- };
- const texts = [
- '1. I am first!',
- '2. I am second!',
- '3. I am in the middle!',
- '4. I am fourth!',
- '5. I am the last one :('
- ];
- const printTableValues = async (input: string[]) => {
- // Your code goes here
- }
- (async () => {
- try {
- await printTableValues(texts);
- document.write(`Printing done!`);
- } catch (err) {
- document.write(`Printing failed! Error details:<br>${err}`);
- }
- })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement