1var items = [[['firstName', 'Joe'], ['lastName', 'Blow'], ['age', 42], ['role', 'clerk']], [['firstName', 'Mary'], ['lastName', 'Jenkins'], ['age', 36], ['role', 'manager']]];
2
3var result = [];
4// first loop through items
5items.forEach(function(item)
6{
7 var obj = {};
8 // then loop through properties
9 item.forEach(function (value)
10 {
11 // then set property and value
12 obj[value[0]] = value[1];
13 });
14
15 // once all is done push the object
16 result.push(obj);
17});
18
19console.log(result);
1var squares = new Array();
2for(var i = 0; i <= 8; i++)
3{
4 squares[i] = new Array();
5 for(var j = (i * 20) + 1; j <= 20 * i + 20; j++)
6 if (squares[i] == null)
7 squares[i] = j;
8 else
9 squares[i].push(j);
10}
11