Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
for var key in obj - keys out of order
var obj1 = {}
define(obj1, 'firstkey', {
get: function() {
return 'firstkey value'
},
enumerable: true
})
var Obj2 = function() {}
Obj2.prototype = obj1
var obj2 = new Obj2()
obj2.secondkey = 'should be last'
for(var k in obj2) {
console.log('key:', k, obj2[k])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.