codecombat / codecombat/codecombat
JavaScript for loops
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 8.6k
- Forks
- 4.2k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 39
Description
I use JS, and I've noticed that, when for looping through an array, a bug appears if I format my loops like I usually do with other platforms:
var array = [];
for (var i in array) {
//do something
}
I'm not sure as to exactly what happens when I do this, but the game thinks that nothing is wrong (no error messages), but it seems like none of the loops formatted like this actually happen, and any functions I use this in return null values.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported JavaScript for...in loop in the game and trace why the loop body is skipped without an error. Identify the relevant execution entry point, then verify that loops over arrays execute and functions using them return their expected values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100