0
Why can't you access the object's indexes without declaring them? I thought an array has indexes automatically
3 ответов
+ 3
How can you access something that doesn't exist?
Edit: looks like you meant initializing instead of declaring. And while you can access an unitialized variable, its value will be just whatever was in memory, ie a garbage value not corresponding to anything.
+ 1
That's because, that particular element you are trying to access has a null value.
Merely declaring an array doesn't mean that you may already access its elements.
you have to initialize its elements first before you can access them.
0
But an array has indexes when it's number of indexes is declared...