---
title: "Discussion on \"Closure in JS\" | Hashnode"
description: "Discussion on \"Closure in JS\". A function along with it's lexical scope inside a function is called closure.\nexample:\nlet's take a we want to increment a value by clicking a button, the basic way we can do it by is using a varible which will be incremented on every click.\nvar clic..."
url: "https://hashnode.com/posts/closure-in-js/6697e497e4691aa867e89d00"
---

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

Discussion

# [Closure in JS](https://preetisays.hashnode.dev/closure-in-js?utm_source=hashnode&utm_medium=feed)

A function along with it's lexical scope inside a function is called closure. example: let's take a we want to increment a value by clicking a button, the basic way we can do it by is using a varible which will be incremented on every click. var clic...

Jul 17, 2024 · 2 min read · preetisays.hashnode.dev  
Read the article

-   [#closure](https://hashnode.com/tag/closure)
-   [#closures-in-javascript](https://hashnode.com/tag/closures-in-javascript)
-   [#iife](https://hashnode.com/tag/iife)
-   [#immediately-invoked-functions](https://hashnode.com/tag/immediately-invoked-functions)
-   [#js](https://hashnode.com/tag/js)
-   [#anonymous-function](https://hashnode.com/tag/anonymous-function)

## Written by

[Preeti](https://hashnode.com/@preeticodes)

@preeticodes · Bengaluru

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

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
