This is a simple problem, and I've done it before. I just can't remember how, or what exactly it was called.
In python I can do this:
arr = ['one', 'two']
one, two = arr
This is currently the only cross-browser-compatible solution AFAIK:
var one = arr, two = arr;
ES6 will allow destructuring assignment:
var [x, y] = ['foo', 'bar']; console.log(x); // 'foo' console.log(y); // 'bar'
Or, to stick to your initial example:
var arr = ['one', 'two']; var [one, two] = arr;