Given for..of example needs some explanation, not self-explaining

Assigned to


2 years ago
a year ago


(Reporter: nachtigall, Assigned: mozilla)






2 years ago
:: Developer Documentation Request

      Request Type: Correction
     Gecko Version: 51 Branch
 Technical Contact:

:: Details

Since there's no other way to leave feedback (you should really have something like a small ThumbsUp/ThumbsDown feedback form on each MDN page), I'll leave this here:

I do not find the example given at self-explaining. In particular, in line 8 why does it log 
// logs 0, 1, 2, "foo", "arrCustom", "objCustom" 
and not
// logs 0, 1, 2, "hello", "arrCustom"

Why "objCustom" if it is an array? Why "foo" if it is "hello"?
Component: General → JavaScript

Comment 1

a year ago
I think that I could make a few changes that would make the doc section better:

- Add a short introductory sentence describing how are for...of and similar and how they differ while keeping the two paragraphs describing what they do almost intact.
- Add an explanation to every couple of lines of the example (lines 1-2, 4-5, 7-9, 11-15, 17-19).
- Add several links to other docs - for example for enumerable properties, hasOwnProperty etc.

Do you agree? Can I work on this?
Yes, feel free to improve the MDN wiki pages! Thank you!
Assignee: nobody → mozilla

Comment 3

a year ago
I've made the necessary changes. I wrote the introduction little differently, other changes are as described in my last comment. 

Are the changes for the better? Feel free to tell me about any mistakes I've made or changes I should do. It's my first contribution so I'm not that sure if everything was done correctly.
You need to log in before you can comment on or make changes to this bug.