document.write(String.constructor);//function Function() { [native code] }
document.write(new String().constructor);//function String() { [native code] }
//反射更是没有数据
for(temp in String){
document.write(String.prototype[temp]);
}我是新手,想问下高手大哥大姐们,能否通过类似java反射技术,反射到String,Math,Array等类的属性及方法??
JS做不到么??
document.write(new String().constructor);//function String() { [native code] }
//反射更是没有数据
for(temp in String){
document.write(String.prototype[temp]);
}我是新手,想问下高手大哥大姐们,能否通过类似java反射技术,反射到String,Math,Array等类的属性及方法??
JS做不到么??
var Test = function() {
var private = { testOne : function () {},
testTwo : function () {},
testThree : function () {}
};
function getMethods() {
for (i in this) {
alert(i); // shows getMethods, but not private methods
//alert(this[i]);
}
for (i in private) {
alert(i); // private methods
}
}
return { getMethods : getMethods }
}();
// will return ['testOne', 'testTwo', 'testThree', 'getMethods']
Test.getMethods();
大师,请问你那怎么得到的啊??? 急求,方法,步骤,前面那兄弟告诉我用firebug 我没有尝试成功
大师不敢当,我只是一个小菜鸟。我用的是google浏览器打印出来的,firefox没有试过。个人不怎么用firefox。
同样的方法firebug显示不出来.//
为什么我google是这样