Skip to content

Commit 3346bc4

Browse files
committed
completed closure assignment
1 parent 34d46b9 commit 3346bc4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

assignments/closure.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
// ==== Challenge 1: Write your own closure ====
22
// Write a simple closure of your own creation. Keep it simple!
3+
function beehive() {
4+
let buzz = [];
5+
6+
function bee() {
7+
buzz.push('buzz');
8+
console.log(buzz.join(''));
9+
}
10+
return bee;
11+
}
12+
13+
let buzzBee = beehive();
14+
buzzBee();
15+
buzzBee();
16+
buzzBee();
317

418

519
/* STRETCH PROBLEMS, Do not attempt until you have completed all previous tasks for today's project files */

0 commit comments

Comments
 (0)