Skip to content

Commit 88b4884

Browse files
authored
Update func.js
1 parent 0871055 commit 88b4884

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Interview-Questions/func.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,28 @@ foo();
99

1010
console.log(a);
1111
console.log(b);
12+
13+
14+
// output
15+
function createIncrement() {
16+
let count = 0;
17+
18+
function increment() {
19+
count++;
20+
}
21+
22+
let message = `Count is ${count}`;
23+
function log() {
24+
console.log(message);
25+
}
26+
27+
return [increment, log];
28+
}
29+
30+
const [increment, log] = createIncrement();
31+
32+
increment();
33+
increment();
34+
increment();
35+
36+
log();

0 commit comments

Comments
 (0)