Skip to content

Commit c726aaf

Browse files
authored
Update func.js
1 parent cc92a49 commit c726aaf

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Interview-Questions/func.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,24 @@ increment();
3434
increment();
3535

3636
log();
37+
38+
// Console sequence output?
39+
function run () {
40+
const promise = new Promise((resolve) => {
41+
resolve('promise');
42+
})
43+
44+
setTimeout(() => {
45+
console.log('setTimeout');
46+
});
47+
48+
promise.then(res => console.log(res))
49+
50+
console.log('log');
51+
}
52+
53+
run();
54+
55+
// How does the Javascript interprets the following code?
56+
console.log(x);
57+
var x = 100;

0 commit comments

Comments
 (0)