Last active
December 21, 2018 14:59
-
-
Save lei-clearsky/b43d4148f441abf3c34884f9f9e3a835 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Problem 1 | |
| (() => { | |
| console.log('this is the start'); | |
| setTimeout(function cb() { | |
| console.log('this is a msg from call back'); | |
| }); | |
| console.log('this is just a message'); | |
| setTimeout(function cb1() { | |
| console.log('this is a msg from call back1'); | |
| }, 0); | |
| console.log('this is the end'); | |
| })(); | |
| // Problem 2 | |
| const bar = () => console.log('bar'); | |
| const baz = () => console.log('baz'); | |
| const foo = () => { | |
| console.log('foo') | |
| setTimeout(bar, 0); | |
| new Promise((resolve, reject) => | |
| resolve('Promise Resolved!') | |
| ).then(resolve => console.log(resolve)); | |
| baz(); | |
| }; | |
| foo(); | |
| // Problem 3 | |
| // Make the following code work: | |
| const a = [1, 2, 3, 4, 5]; | |
| // Implement this | |
| a.multiply(); | |
| console.log(a); // [1, 2, 3, 4, 5, 1, 4, 9, 16, 25] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment