随笔分类 -  javascript

摘要:在学习JS的面向对象过程中,一直对constructor与prototype感到很迷惑,看了一些博客与书籍,觉得自己弄明白了,现在记录如下: 我们都知道,在JS中有一个function的东西。一般人们叫它函数。比如下面的代码js代码:function Person(name) { alert(name); } Person('js');//js 上面的代码中,Person的表现的确跟一般的函数没有什么区别,接着看下面的代码function Person(name) { this.name=name; this.showMe=function() { alert(this.nam 阅读全文
posted @ 2012-09-22 23:34 小皮球 阅读(243) 评论(0) 推荐(0)