Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,31 @@
|
|||
var obj = Object.create({
|
||||
name: 'proto',
|
||||
proto: true,
|
||||
doNothing: function() {}
|
||||
}, {
|
||||
name: {value: 'obj', writable: true, configurable: true, enumerable: true},
|
||||
obj: {value: true, writable: true, configurable: true, enumerable: true},
|
||||
'non-enum': {value: 'non-enumerable', writable: true, enumerable: false},
|
||||
doStuff: {value: function() {}, enumerable: true}
|
||||
});
|
||||
|
||||
// get enumerable properties on an object and its ancestors
|
||||
function get_property_names(obj) {
|
||||
var properties = [];
|
||||
for (var p in obj) {
|
||||
properties.push(p);
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
get_property_names(obj);
|
||||
//["name", "obj", "doStuff", "proto", "doNothing"]
|
||||
|
||||
Object.getOwnPropertyNames(obj);
|
||||
//["name", "obj", "non-enum", "doStuff"]
|
||||
|
||||
Object.keys(obj);
|
||||
//["name", "obj", "doStuff"]
|
||||
|
||||
Object.entries(obj);
|
||||
//[["name", "obj"], ["obj", true], ["doStuff", function()]]
|
||||
Loading…
Add table
Add a link
Reference in a new issue