1var foo = { pName1 : 1, pName2 : [1, {foo : bar }, 3] , ...}
2
3var name = "pName"
4var num = 1;
5
6foo[name + num]; // 1
7
8// --
9
10var a = 2;
11var b = 1;
12var c = "foo";
13
14foo[name + a][b][c]; // bar
1let me = {
2 name: 'samantha',
3};
4
5// 1. Dot notation
6me.name; // samantha
7
8// 2. Bracket notation (string key)
9me['name']; // samantha
10
11// 3. Bracket notation (variable key)
12let key = 'name';
13me[key]; // samantha
14