Created
July 3, 2015 09:20
-
-
Save marcusbesjes/0a390c60c3bde8360c64 to your computer and use it in GitHub Desktop.
for var key in obj - keys out of order
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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