---
title: "Comment by Devang on \"Simplifying Closures in JavaScript\" | Hashnode"
description: "index is not defined in Closures in a loop. It will throw an error."
url: "https://hashnode.com/posts/simplifying-closures-in-javascript/62e7d4fe053e6bd57842a3a6/comment/62e90bb83f084d032011d9de"
---

[Discussion](https://hashnode.com/posts/simplifying-closures-in-javascript/62e7d4fe053e6bd57842a3a6)

Comment [Simplifying Closures in JavaScript](https://hashnode.com/posts/simplifying-closures-in-javascript/62e7d4fe053e6bd57842a3a6)

[Devang](https://hashnode.com/@devangpatil)

[Aug 2, 2022](https://hashnode.com/posts/simplifying-closures-in-javascript/62e7d4fe053e6bd57842a3a6/comment/62e90bb83f084d032011d9de)

index is not defined in Closures in a loop. It will throw an error.

[Ayesha Sahar](https://hashnode.com/@IAyeshaSahar)

[Aug 2, 2022](https://hashnode.com/posts/simplifying-closures-in-javascript/62e7d4fe053e6bd57842a3a6/comment/62e90bb83f084d032011d9de#reply-62e90d4f3f084d032011da1b)

Sorry for the trouble! Thanks for telling me. I've updated the code :)
