---
title: "Discussion on \"JavaScript: How to remember the difference between \"for...in\" and \"for...of\"\" | Hashnode"
description: "Discussion on \"JavaScript: How to remember the difference between \"for...in\" and \"for...of\"\". There was a young programmer in BerlinWho constructed a for loop with inShe found the effect isA series of indexesAnd swore ne'er to use it again.\n\nDon't use for...in\nHere's what happened to our programmer in Berlin:\nconst cities = [\"Berlin\", \"Prague..."
url: "https://hashnode.com/posts/javascript-how-to-remember-the-difference-between-forin-and-forof/5f8093bcf829251669389a9f"
---

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

Discussion

# [JavaScript: How to remember the difference between "for...in" and "for...of"](https://spaceaardvark.hashnode.dev/javascript-how-to-remember-the-difference-between-forin-and-forof?utm_source=hashnode&utm_medium=feed)

There was a young programmer in BerlinWho constructed a for loop with inShe found the effect isA series of indexesAnd swore ne'er to use it again. Don't use for...in Here's what happened to our programmer in Berlin: const cities = \["Berlin", "Prague...

Oct 9, 2020 · 2 min read · spaceaardvark.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#2articles1week](https://hashnode.com/tag/2articles1week)

## Written by

[Space Aardvark](https://hashnode.com/@spaceaaradvark)

@spaceaaradvark · Texas, USA

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

Frontend, Fintech, and Fadoodles

Hi, I'm Seth Livingston, a Senior Software Engineer at Moov Financial. Aardvark by abraham.williams (https://www.flickr.com/photos/14939682@N02) Space background by Jeremy Perkins (https://unsplash.com/@jeremyperkins?utm\_source=unsplash&amp;utm\_medium=referral&amp;utm\_content=creditCopyText)

## Responses 2

Markdown supported · ⌘↵ to post

[Samuel Kubiti](https://hashnode.com/@Kubiti)

[Nov 25, 2020](https://hashnode.com/posts/javascript-how-to-remember-the-difference-between-forin-and-forof/5f8093bcf829251669389a9f/comment/5fbe9b8fd73a0534d9b513a0)

Useful content, I always had to look up the differences when I wanted to use one.

[Swarnim Walavalkar](https://hashnode.com/@SwarnimWalavalkar)

[Oct 9, 2020](https://hashnode.com/posts/javascript-how-to-remember-the-difference-between-forin-and-forof/5f8093bcf829251669389a9f/comment/5f80af245841661b519cfe70)

Expertly succinct and very informative, Great Job! 👍🏻😀
