关注
function hardMan(str) {
this.queue = []
this.name = str
this.queue.push(() => {
console.log(this.name);
this.next()
});
}
hardMan.prototype.rest = function (wait) {
const func = () => {
setTimeout(() => {
console.log(`Start learning after ${wait} seconds`)
this.next()
}, wait * 1000)
}
this.queue.push(func)
return this
}
hardMan.prototype.restFirst = function (wait) {
const func = () => {
setTimeout(() => {
console.log(`Start learning after ${wait} seconds`)
this.next()
}, wait * 1000)
}
this.queue.unshift(func)
return this
}
hardMan.prototype.learn = function (str) {
const func = () => {
console.log(`Learning ${str}`)
}
this.queue.push(func)
this.next()
}
hardMan.prototype.next = function () {
if (this.queue.length === 0) return
const func = this.queue.shift()
func()
}
const HardMan = (name)=>{
return new hardMan("jack");
}
查看原帖
4 1
相关推荐
02-14 16:04
门头沟学院 FAE 点赞 评论 收藏
分享
编程有术:那就投央国企就好了,学历足够 简历稍微润色下,做点项目,比如农发西安,中行西安,应该没问题,这俩单位都有同学在里面,反馈不错 点赞 评论 收藏
分享
牛客热帖
更多
正在热议
更多
# xx岗简历求拷打 #
15906次浏览 144人参与
# 找工作有哪些冷知识 #
226366次浏览 2680人参与
# 开工第一帖 #
53954次浏览 943人参与
# 掌握什么AI技能,会为你的求职大大加分 #
12425次浏览 469人参与
# 有转正机会的小厂实习值得去吗? #
11583次浏览 115人参与
# 应届生,你找到工作了吗 #
108142次浏览 634人参与
# 打工人的精神状态 #
137865次浏览 1506人参与
# 携程求职进展汇总 #
893620次浏览 5940人参与
# 工作不开心辞职是唯一出路吗 #
10689次浏览 44人参与
# 你最讨厌面试被问什么 #
12468次浏览 137人参与
# 金三银四,你有感觉到吗 #
698046次浏览 6099人参与
# 如何看待offer收割机的行为 #
1050030次浏览 6612人参与
# 选实习,你更看重哪方面? #
68320次浏览 491人参与
# 远程面试的尴尬瞬间 #
329576次浏览 1919人参与
# 面试题刺客退退退 #
536951次浏览 7534人参与
# 面试反问你会问什么 #
170096次浏览 1746人参与
# 求职季如何保持心态不崩 #
215187次浏览 1473人参与
# 哪些公司开春招了? #
35999次浏览 210人参与
# 关于春招/暑期实习,你想知道哪些信息? #
19312次浏览 185人参与
# 找工作中的小确幸 #
81939次浏览 457人参与
OPPO公司福利 1262人发布