Skip to content

Commit df85cf9

Browse files
authored
Update output.js
1 parent c34b09f commit df85cf9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Interview-Questions/output.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,20 @@
33

44
// 2) What is the output of "10"+20+30 in JavaScript?
55
// Ans: 102030 because after a string all the + will be treated as string concatenation operator (not binary +).
6+
7+
// 3) Output?
8+
// Syncronous
9+
[1, 2, 3, 4].forEach((i) => {
10+
console.log(i)
11+
})
12+
13+
// Asynchronous
14+
function asyncForEach(array, cb) {
15+
array.forEach(() => {
16+
setTimeout(cb, 0);
17+
})
18+
}
19+
20+
asyncForEach([1, 2, 3, 4], (i) => {
21+
console.log(i);
22+
})

0 commit comments

Comments
 (0)