ITeye博客

2017 年文章归档

共 1 篇文章

两道面试题

1. 编程题 1) 请用js定义一个Animal类,包含属性name以及方法sleep 2) 请定义Person类,继承上面的类,并添加speak方法 function Animal() { this.name = ''; } Animal.prototype.sleep = function () { console.log('sleep...'); }; function Person () {} Person.prototype = new Animal(); Person.prototype.constructor = Person; Person.prototype.speak =…

2017-11-10 10:19 · 面试题