'How to make multi dimensional using Javascript like in PHP and make a forloop?

How to make multi dimensional using Javascript like in PHP? Ex: in PHP you can make arrays like this

$a = [];
for ($x = 0; $x <= 10; $x++) {
    $a[$x]['names'] = 'some names';
    $a[$x]['age'] = 12+$x;
}

so in javascript I can pull data like this:

console.log(a[0]['age']) //will display the age

is this possible in javascript? and how to iterate (forloop/foreach) it to handle the data in javascript also?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source