What do you make of this?
var x = {a: 1}; //=> {a: 1}
var y = Object.keys(x); //=> [\'a\']
x[y] //=> 1
@Quentin suggests that property names are automatically converted to strings. Ok, I think he's onto something there, but giving two explicit arr.toString()
examples doesn't really demonstrate accessing the property of an object using an array. I offered this as an edit to his post. However, he rolled it back.
Anyway, this demonstrates the implicit behavior much more evidently, imo.
var x = {'a,b,c': 1};
var y = ['a','b','c'];
x[y]; //=> 1