JScript(ES3,在VBA中的ScriptControl ActiveX对象中)是否支持创建不可枚举的参数?

时间:2018-04-12 20:09:08

标签: javascript properties jscript enumerable ecmascript-3

如果我将一个属性/函数定义为一个Object原型(假设强制最终将导致所有变量访问属性/函数),那么......



Object.prototype.doFunc = function(){ return 'this is ' + this;}
// OUTPUT - function(){ return 'this is ' + this;}
Object.prototype.doFunc.dontEnum = true
// OUTPUT - True




然后我在一个对象上运行for..in枚举器,即使对象的doFunc求值为{{1},.propertyIsEnumerable('doFunc')函数也出现在枚举中}}

有什么想法? (这也适用于VBA项目中ScriptControl对象的ECMA Script 3 / JScript。)

0 个答案:

没有答案