javascript筆試題
javascript面向?qū)ο笾欣^承實現(xiàn)
javascript面向?qū)ο笾械睦^承實現(xiàn)一般都使用到了構(gòu)造函數(shù)和Prototype原型鏈,簡單的代碼如下:
function Animal(name) {
this.name = name;
}
Animal.prototype.getName = function() {alert(this.name)}
function Dog() {};
Dog.prototype = new Animal("Buddy");
Dog.prototype.constructor = Dog;
var dog = new Dog();
【javascript筆試題】相關(guān)文章:
百度JavaScript筆試題11-19
360筆試題目07-11
華為2017筆試題08-16
百度JavaScript筆試題目11-27
華為2017筆試試題08-10
桂林銀行筆試題筆經(jīng)07-20
調(diào)用javascript11-23
Javascript模板11-23
淺談javascript數(shù)組06-19