---
title: "Discussion on \"Closures:\" | Hashnode"
description: "Discussion on \"Closures:\". 1. First Loop (with differentScope function):\nfor(var i=1;i<=5;i++){\n    const differentScope = (i)=>{\n        setTimeout(()=>{\n            console.log(i)\n        },i*1000);\n    }\n    differentScope(i);\n}\n\nOutput: 1 2 3 4 5 (each number printed at 1-..."
url: "https://hashnode.com/posts/closures/682fe1ae7e4e058c3de0cfff"
---

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

Discussion

# [Closures:](https://cleanclosure.hashnode.dev/closures?utm_source=hashnode&utm_medium=feed)

1\. First Loop (with differentScope function): for(var i=1;i<=5;i++){ const differentScope = (i)=>{ setTimeout(()=>{ console.log(i) },i\*1000); } differentScope(i); } Output: 1 2 3 4 5 (each number printed at 1-...

May 23, 2025 · 2 min read · cleanclosure.hashnode.dev  
Read the article

-   [#closures-in-javascript](https://hashnode.com/tag/closures-in-javascript)

## Written by

[Vishal Pandey](https://hashnode.com/@Vishal070)

@Vishal070

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

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
