- function foo() {
- foo.abc = function() { alert('456'); };
- this.def = this.abc;
- this.abc = function() { alert('def'); };
- abc = function() { alert('@@@@@@'); };
- var abc = function() { alert('$$$$$$'); };
- }
- foo.abc = function() { alert('123'); };
- foo.prototype = {
- abc : function() { alert('abc'); }
- }
- var f = new foo();
- f.def();
- f.abc();
- foo.abc();
- alert(foo["abc"]);
- //该片段来自于http://www.codesnippet.cn/detail/170920135980.html
来源: http://www.codesnippet.cn/detail/170920135980.html