Сообщение от angelzzz
|
на строке a = s[0];
|
var arr = [
{key:1, val:123, val2:1},
{key:2, val:223, val2:2},
{key:3, val:323, val2:2},
{key:4, val:423, val2:1}
], obj = {}, a,b;
Object.keys(arr).forEach(function (a) {
var el = arr[a];
obj[el.key] = [el.val,el.val2];
});
var s = obj[1];
a = s[0];
b = s[1];
alert(a+ " - " + b)