Query.fn.aQuery.init {}
ajQuery.fn = ajQuery.prototype = { ? ?name: 'aaron', ? ?init: function() { ? ? ? ?console.log(this) ? ?}, ? ?constructor: ajQuery } 為什么輸入的是 aQuery.fn.aQuery.init {} 如果去掉 aQuery.fn= ?就是 aQuery.init ?
ajQuery.fn = ajQuery.prototype = { ? ?name: 'aaron', ? ?init: function() { ? ? ? ?console.log(this) ? ?}, ? ?constructor: ajQuery } 為什么輸入的是 aQuery.fn.aQuery.init {} 如果去掉 aQuery.fn= ?就是 aQuery.init ?
2015-04-18
舉報
2016-01-21
ajQuery.fn和ajQuery.prototype指向同一個原型對象,fn比prototype省略了7個字母,使用次數越多這樣做的好處就體現出來了。aQuery.fn.aQuery.init {}這樣的寫法是錯誤的,aQuery.fn.init {}和ajQuery.prototype.init {}是一回事