Javascript Object.getOwnPropertyNames在数组中,但包含主属性

Javascript Object.getOwnPropertyNames在数组中,但包含主属性,javascript,arrays,object,Javascript,Arrays,Object,我已经使用Object.getOwnPropertyNames一段时间了。这是我的代码: var ObjectAdditions = { deepFreeze: function(o) {//code}, extendToArray: function(object) {//code} }; var properties = Object.getOwnPropertyNames(ObjectAdditions); 这就是properties得出的结论: ["deepFreeze

我已经使用
Object.getOwnPropertyNames
一段时间了。这是我的代码:

var ObjectAdditions = {
    deepFreeze: function(o) {//code},
    extendToArray: function(object) {//code}
};
var properties = Object.getOwnPropertyNames(ObjectAdditions);
这就是
properties
得出的结论:

["deepFreeze", "extendToArray"]

不幸的是,我还期望出现“原型”和“构造函数”等属性。我如何才能做到这一点?

您的
ObjectAdditions
只是一个简单的对象,属性为
deepFreeze
extendetoarray
。这不是一门课

Object.getOwnPropertyNames
与类类似:

class-MyClass{
//除了MyClass()本身,cunstructer在其他任何地方都不会出现。它只能用“new”调用。
构造函数(){
//这将作为属性添加到实例中
this.myInstanceAttribute=null;
}
//这将作为属性添加到类中
静态myStaticFunction(){}
//这将添加到原型中
myInstanceFunction(){}
}
MyClass.myStaticAttribute=null;
//显示类原型和名称、构造函数的静态和长度(预期参数的数量)
log('class',Object.getOwnPropertyNames(MyClass));
//仅添加了“myInstanceAttribute”

log('instance',Object.getOwnPropertyNames(newMyClass())这是否回答了您的问题?我不是指原型的属性,我是指原型本身