var x = 10;
var y = 3;
var arr = [x,y];
arr
получить строкой "x"
и "y"
? {
0: 10,
1: 3,
length: 2,
__proto__: Array(0)
}
var x = 10;
var y = 3;
var obj = { x: x, y: y };
var keys = Object.keys(obj);
console.log(keys);
// => [ 'x', 'y']