标签:16px 对象 this 实例 set ros ring size console
题目:
实现一个
person
对象,有eat
和dinner
两种方法
请用实例[依次类推]
new person("Tom").sleep(10).eat("dinner");
//输出
console.log("hello Tom")
//等待10s,
console.log("sleep 10s"),
console.log("eat dinner")
看似是实现一个对象上面方法的链式调用。在调用eat方法的时候其实eat方法的target对象已经是new person(‘Tome‘).sleep(10);
Thus,要在sleep的方法里面
标签:16px 对象 this 实例 set ros ring size console
原文地址:https://www.cnblogs.com/tangjiao/p/8969003.html