search

Home  >  Q&A  >  body text

Array object Unexpected identifier - Stack Overflow

The problem is as shown in the picture,
I don’t understand why undefined is displayed in the program? The console reports an error?

给我你的怀抱给我你的怀抱2707 days ago863

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-07-05 10:58:12

    Your array only has two items, so if you get a[3], the fourth item will of course be undefined...

    The same is true for the ob object. It does not have a key of 3, but only a key of 1.

    reply
    0
  • Cancelreply