Closed
Bug 1307755
Opened 8 years ago
Closed 5 years ago
Given for..of example needs some explanation, not self-explaining
Categories
(Developer Documentation Graveyard :: JavaScript, defect, P5)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: nachtigall, Assigned: mail)
References
()
Details
:: Developer Documentation Request
Request Type: Correction
Gecko Version: 51 Branch
Technical Contact: fscholz@mozilla.com
:: 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 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of#Difference_between_for...of_and_for...in 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"?
Updated•8 years ago
|
Component: General → JavaScript
Assignee | ||
Comment 1•7 years 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 for...in 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?
Comment 2•7 years ago
|
||
Yes, feel free to improve the MDN wiki pages! Thank you!
Assignee: nobody → mozilla
Assignee | ||
Comment 3•7 years 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.
Comment 4•5 years ago
|
||
Thanks for your work! It looks good to me. There was a sentence that says for-in is iterating in insertion order, but we've corrected that. (see https://github.com/mdn/sprints/issues/863). I'm closing this here now.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•