---
title: "Discussion on \"Understanding \"Closures\" and Lexical Environment\" | Hashnode"
description: "Discussion on \"Understanding \"Closures\" and Lexical Environment\". Couldn't understand closures? Let's clear this."
url: "https://hashnode.com/posts/understanding-closures-and-lexical-environment/60f78c673e181324dac717c6"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Understanding "Closures" and Lexical Environment](https://mansoorameen.hashnode.dev/understanding-closures-and-lexical-environment?utm_source=hashnode&utm_medium=feed)

Couldn't understand closures? Let's clear this.

Jul 21, 2021 · 2 min read · mansoorameen.hashnode.dev  
Updated Jul 30, 2021  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#programming](https://hashnode.com/tag/programming)
-   [#functional-programming](https://hashnode.com/tag/functional-programming)
-   [#js](https://hashnode.com/tag/js)
-   [#closure](https://hashnode.com/tag/closure)

## Written by

[Mansoor Ameen](https://hashnode.com/@mansoorameen)

@mansoorameen

  
[View profile](https://hashnode.com/@mansoorameen)

Self-taught coder | Front-end developer

## Responses 1

Markdown supported · ⌘↵ to post

[Paarth Bajaj](https://hashnode.com/@PaarthBajaj)

[Jul 30, 2021](https://hashnode.com/posts/understanding-closures-and-lexical-environment/60f78c673e181324dac717c6/comment/6103efbf9036db5b3513c69f)

Now if you combine all those functions (not one, but all) with each of their lexical environment, that is called Closure! Explain this in the code please.

[Mansoor Ameen](https://hashnode.com/@mansoorameen)

[Jul 30, 2021](https://hashnode.com/posts/understanding-closures-and-lexical-environment/60f78c673e181324dac717c6/comment/6103efbf9036db5b3513c69f#reply-61040d1e805a765b08876dee)

[Paarth Bajaj](https://hashnode.com/@PaarthBajaj) Functions form closures. Here each function forms a closure, and that's why they can access var num.

[Paarth Bajaj](https://hashnode.com/@PaarthBajaj)

[Jul 30, 2021](https://hashnode.com/posts/understanding-closures-and-lexical-environment/60f78c673e181324dac717c6/comment/6103efbf9036db5b3513c69f#reply-610410b0805a765b08876f00)

Thank you for answering my stupid doubts! [Mansoor Ameen](https://hashnode.com/@mansoorameen)

[Mansoor Ameen](https://hashnode.com/@mansoorameen)

[Jul 30, 2021](https://hashnode.com/posts/understanding-closures-and-lexical-environment/60f78c673e181324dac717c6/comment/6103efbf9036db5b3513c69f#reply-6104184e805a765b0887702c)

[Paarth Bajaj](https://hashnode.com/@PaarthBajaj) Glad to be of some help :)
