JavaScript (!) for dummies #3
If you’re new to programming you might not be familiar with concept of storing data in arrays. They are tiny little (in this case dynamic) containers that can contain some value mapped to numbers from 0 to n. But in fact they can offer much more functionalities that you might not be aware of.
Really short info for new comers:
Arrays in JS can be jagged. What does it mean? I means that if you more than one dimensions the sizes don’t have to be even. The following code fully legal.
Obviously you won’t access every single element independently. The most convenient way to do it for now is using a for loop that i introduced in [first]/JSForDummies1/ article.
Cool! But what if array have more than dimension? The answer is very simple, more for loops…
If you’ll run the code you’ll find out that it prints every single element without concerning whether the dimensions of inside array have changed. It does that because array[1] return another array [3,2] which has it’s independent .length field.
Exercises: WIP