-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmultidimensional-array.js
43 lines (31 loc) · 1.02 KB
/
multidimensional-array.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
A multidimensional array is an array containing one or more arrays.
I make two list for exemplo:
* Games:
- God of War
- Battle Field
- GTA V
- Fifa 2016
- Need for Speed no Limits
* Consoles:
- Xbox One
- PS4
- Nintendo 64
- Ps Vita
- Nintendo Ui
*/
var nerdStore = Array();
nerdStore['games'] = Array();
nerdStore['games'][1] = 'God of War';
nerdStore['games'][2] = 'Battle Field';
nerdStore['games'][3] = 'GTA V';
nerdStore['games'][4] = 'Fifa 2016';
nerdStore['games'][5] = 'Need for Speed no Limits';
document.write(nerdStore['games'][2]);
// or we can assign as follows
nerdStore['consoles'] = ['Xbox One', 'PS4', 'Nintendo 64', 'Ps Vita', 'Nintendo Ui'];
document.write(nerdStore['consoles'][0]);
// or like this
nerdStore['other_consoles'] = Array('PC Gamer', 'Nintendo 3DS', 'Super nintendo', 'Mega Drive', 'Game Cubo');
document.write(nerdStore['other_consoles'][3]);
// you can test this code in: https://jsfiddle.net/