Object.prototype.toArray = function() { var array = []; for (var i in this) { if(this.hasOwnProperty(i)) { array.push(this[i]); } } return array; } alert({foo : 1, bar : 2}.toArray());