Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Draft saved
Draft discarded
Cancel
7
  • 1
    Your first element would be enemies[0] Commented Sep 15, 2015 at 12:24
  • Your "array" is invalid syntax. Commented Sep 15, 2015 at 12:24
  • var enemies = [{x:0, y:0}, {x:5, y:5}, {x:10, y:10}]; then just refer to enemies[index].x Commented Sep 15, 2015 at 12:25
  • 1
    @Xufox It's not invalid, he's just creating a global (position). Commented Sep 15, 2015 at 12:25
  • 2
    possible duplicate of Access / process (nested) objects, arrays or JSON Commented Sep 15, 2015 at 12:26

lang-js

AltStyle によって変換されたページ (->オリジナル) /