Skip to content

Commit a8d736a

Browse files
committed
another closure property in JS
1 parent 8d4f534 commit a8d736a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

closure.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,17 @@ function f1() {
1414
var c = f1();
1515
console.log(c);
1616
c();
17+
18+
//Closures :
19+
//Closure is an important JavaScript pattern to give private access to a variable
20+
function closures(val)
21+
{
22+
return function (name)
23+
{
24+
console.log(val+" "+name);
25+
}
26+
}
27+
const greet = closures("Hello");
28+
greet("Kirtti");
29+
30+

0 commit comments

Comments
 (0)