---
title: "Discussion on \"I can't write a JavaScript for loop, and it does not matter\" | Hashnode"
description: "Discussion on \"I can't write a JavaScript for loop, and it does not matter\". I've been using JavaScript daily for 7 years, and I'm not able to remember the syntax of a JavaScript for loop.\nDespite this fact, I'm a rather successful freelance developer. Recently I even had the awesome opportunity to work for Facebook, as the D..."
url: "https://hashnode.com/posts/i-cant-write-a-javascript-for-loop-and-it-does-not-matter/5f76e5b37d160d41227d65cb"
---

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

Discussion

# [I can't write a JavaScript for loop, and it does not matter](https://daily.sebastienlorber.com/i-cant-write-a-javascript-for-loop-and-it-does-not-matter?utm_source=hashnode&utm_medium=feed)

I've been using JavaScript daily for 7 years, and I'm not able to remember the syntax of a JavaScript for loop. Despite this fact, I'm a rather successful freelance developer. Recently I even had the awesome opportunity to work for Facebook, as the D...

Oct 2, 2020 · 9 min read · daily.sebastienlorber.com  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#frontend-development](https://hashnode.com/tag/frontend-development)

## Written by

[Sébastien Lorber](https://hashnode.com/@sebastienlorber)

@sebastienlorber · Paris, France

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

React early adopter. Freelance, working on Docusaurus with Facebook

## Responses 5

Markdown supported · ⌘↵ to post

[Philippe Bernard](https://hashnode.com/@Philippe)

[Oct 8, 2020](https://hashnode.com/posts/i-cant-write-a-javascript-for-loop-and-it-does-not-matter/5f76e5b37d160d41227d65cb/comment/5f7f5fdeb8638504a7c1201e)

Thank you for this article! I'm pleased to see I'm not the only one to not remember stuff considered basic. My favorite: finding out I've already upvoted the SO answer I'm looking for :)

[Sébastien Lorber](https://hashnode.com/@sebastienlorber)

[Oct 8, 2020](https://hashnode.com/posts/i-cant-write-a-javascript-for-loop-and-it-does-not-matter/5f76e5b37d160d41227d65cb/comment/5f7f5fdeb8638504a7c1201e#reply-5f7f6f95addab004867df75e)

Thanks 😉

Or finding that you actually answered the question you ask for 10 years ago 😅 as I've got 70k on Stackoverflow it actually happens 😄

[Philippe Bernard](https://hashnode.com/@Philippe)

[Oct 8, 2020](https://hashnode.com/posts/i-cant-write-a-javascript-for-loop-and-it-does-not-matter/5f76e5b37d160d41227d65cb/comment/5f7f5fdeb8638504a7c1201e#reply-5f7f78f5b8638504a7c1218e)

[Sébastien Lorber](https://hashnode.com/@sebastienlorber) SO-auto-rickroll 😂

[Júlio César Ködel](https://hashnode.com/@jck)

[Oct 8, 2020](https://hashnode.com/posts/i-cant-write-a-javascript-for-loop-and-it-does-not-matter/5f76e5b37d160d41227d65cb/comment/5f7f4166b8638504a7c11eda)

This is one of the most stupid article I began to read (could not read until the end, too painfull).

There is a lot of uses for indexed array access (including, for instance, comparing or using two correlated arrays with only one loop, instead of a nested loop).

Using a function call requires stack manipulation, context switching, etc. Is slow as hell. Thousands of times slow (but don't trust me, do a test, as any scientific method requires).

You are just a bad programmer and hashnode just became a Medium competitor (in article quality).

[Sébastien Lorber](https://hashnode.com/@sebastienlorber)

[Oct 8, 2020](https://hashnode.com/posts/i-cant-write-a-javascript-for-loop-and-it-does-not-matter/5f76e5b37d160d41227d65cb/comment/5f7f4166b8638504a7c11eda#reply-5f7f6f35addab004867df756)

I can indeed write for loops with indices if perf matters, but in most cases it's premature optimisation.

Do you always prematurely optimize? Do you feel a for loop is always the best solution for lists of size 10?

[Younis Shah](https://hashnode.com/@wyy)

[Oct 2, 2020](https://hashnode.com/posts/i-cant-write-a-javascript-for-loop-and-it-does-not-matter/5f76e5b37d160d41227d65cb/comment/5f7742919c3b6e4101215dbd)

Enhanced for loop was introduced in [Java 5](https://www.oracle.com/technical-resources/articles/java/java-5-features.html), not Java 6.

[Sébastien Lorber](https://hashnode.com/@sebastienlorber)

[Oct 2, 2020](https://hashnode.com/posts/i-cant-write-a-javascript-for-loop-and-it-does-not-matter/5f76e5b37d160d41227d65cb/comment/5f7742919c3b6e4101215dbd#reply-5f775cc59c3b6e4101215eb2)

Ah good point. I guess my school teachers were using Java4 :D

[Kuldeep Bhatt](https://hashnode.com/@Robus)

[Oct 2, 2020](https://hashnode.com/posts/i-cant-write-a-javascript-for-loop-and-it-does-not-matter/5f76e5b37d160d41227d65cb/comment/5f773f969c3b6e4101215da5)

This is a brilliant read! Absolute quality.

[Sébastien Lorber](https://hashnode.com/@sebastienlorber)

[Oct 2, 2020](https://hashnode.com/posts/i-cant-write-a-javascript-for-loop-and-it-does-not-matter/5f76e5b37d160d41227d65cb/comment/5f773f969c3b6e4101215da5#reply-5f7741dc9c3b6e4101215db7)

Thanks :)

[Sandeep Panda](https://hashnode.com/@sandeep)

[Oct 2, 2020](https://hashnode.com/posts/i-cant-write-a-javascript-for-loop-and-it-does-not-matter/5f76e5b37d160d41227d65cb/comment/5f76e95f9c3b6e41012157fe)

Nice write up. :-) Please tag it with JavaScript tag for better reach.

[Sébastien Lorber](https://hashnode.com/@sebastienlorber)

[Oct 2, 2020](https://hashnode.com/posts/i-cant-write-a-javascript-for-loop-and-it-does-not-matter/5f76e5b37d160d41227d65cb/comment/5f76e95f9c3b6e41012157fe#reply-5f77014b7d160d41227d6835)

Thanks, forgot the tags :)
