We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 06c3e1b commit e0a8464Copy full SHA for e0a8464
1 file changed
Programs/Exercise/hellofun.js
@@ -0,0 +1,26 @@
1
+/*
2
+
3
+Write a function createHelloWorld.
4
+It should return a new function that always returns
5
+"Hello World".
6
7
8
+Example 1:
9
10
+Input: args = []
11
+Output: "Hello World"
12
+Explanation:
13
+const f = createHelloWorld();
14
+f(); // "Hello World"
15
+*/
16
17
+var createHelloWorld = function() {
18
19
+ return function(...args) {
20
21
+ return "Hello World"
22
23
+ }
24
+};
25
26
+console.log(createHelloWorld()()); // Hello World
0 commit comments