promise
.then((res) => {
console.log('then: ', res)
})
.catch((err) => {
console.log('catch: ', err)
})
#05
===
难易程度:⭐⭐
const promise = new Promise((resolve, reject) => {
setTimeout(() => {
console.log(‘once’)
resolve(‘success’)
}, 1000)
})
const start = Date.now()
promise.then((res) => {
console.log(res, Date.now() - start)
})
promise.then((res) => {
console.log(res, Date.now() - start)
})
#06
===
难易程度:⭐⭐⭐
Promise.resolve()
.then(() => {
return new Error(‘error!!!’)
})
.then((res) => {
console.log('then: ', res)
})
.catch((err) => {
console.log('catch: ', err)
})
#07
===
难易程度:⭐⭐⭐⭐
const promise = Promise.resolve()
.then(() => {
return promise
})
promise.catch(console.error)
#08
===
难易程度:⭐⭐⭐
Promise.resolve(1)
.then(2)
.then(Promise.resolve(3))
.then(console.log)
#09
===
难易程度:⭐⭐⭐
Promise.resolve()
.then(function success (res) {
throw new Error(‘error’)
}, function fail1 (e) {
console.error('fail1: ', e)
})
.catch(function fail2 (e) {
console.error('fail2: ', e)
})
变种后
Promise.resolve()
.then(function success1 (res) {
throw new Error(‘error’)
}, function fail1 (e) {
console.error('fail1: ', e)
})
.then(function success2 (res) {
}, function fail2 (e) {
console.error('fail2: ', e)
})
#10
===
难易程度:⭐⭐⭐⭐
process.nextTick(() => {
console.log(‘nextTick’)
})
Promise.resolve()
.then(() => {
console.log(‘then’)
})
setImmediate(() => {
console.log(‘setImmediate’)
})
console.log(‘end’)
#11
===
难易程度:⭐⭐⭐⭐
const first = () => (new Promise((resolve, reject) => {
console.log(3);
let p = new Promise((resolve, reject) => {
console.log(7);
setTimeout(() => {
console.log(5);
resolve(6);
}, 0)
resolve(1);
});
resolve(2);
p.then((arg) => {
console.log(arg);
});
}));
first().then((arg) => {
console.log(arg);
});
console.log(4);
#12
===
难易程度:⭐⭐
var p = new Promise((resolve, reject) => {
reject(Error(‘The Fails!’))
})
p.catch(error => console.log(error.message))
p.catch(error => console.log(error.message))
#13
===
难易程度:⭐⭐⭐
var p = new Promise((resolve, reject) => {
return Promise.reject(Error(‘The Fails!’))
})
p.catch(error => console.log(error.message))
p.catch(error => console.log(error.message))
#14
===
难易程度:⭐⭐
var p = new Promise((resolve, reject) => {
reject(Error(‘The Fails!’))
})
.catch(error => console.log(error))
.then(error => console.log(error))
#15
===
难易程度:⭐⭐
new Promise((resolve, reject) => {
resolve(‘Success!’)
})
.then(() => {
throw Error(‘Oh noes!’)
})
.catch(error => {
return “actually, that worked”
})
.catch(error => console.log(error.message))
#16
===
难易程度:⭐⭐
Promise.resolve(‘Success!’)
.then(data => {
return data.toUpperCase()
})
.then(data => {
console.log(data)
return data
})
.then(console.log)
#17
===
难易程度:⭐⭐
Promise.resolve(‘Success!’)
.then(() => {
throw Error(‘Oh noes!’)
})
.catch(error => {
return ‘actually, that worked’
})
.then(data => {
throw Error(‘The fails!’)
})
.catch(error => console.log(error.message))
#18
===
难易程度:⭐⭐⭐⭐
const first = () => (new Promise((resolve,reject)=>{
console.log(3);
let p = new Promise((resolve, reject)=>{
console.log(7);
setTimeout(()=>{
console.log(5);
resolve(6);
},0)
resolve(1);
});
resolve(2);
p.then((arg)=>{
console.log(arg);
});
}));
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数前端工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Web前端开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上前端开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新
如果你觉得这些内容对你有帮助,可以添加V获取:vip1024c (备注前端)
最后
好了,这就是整理的前端从入门到放弃的学习笔记,还有很多没有整理到,我也算是边学边去整理,后续还会慢慢完善,这些相信够你学一阵子了。
做程序员,做前端工程师,真的是一个学习就会有回报的职业,不看出身高低,不看学历强弱,只要你的技术达到应有的水准,就能够得到对应的回报。
学习从来没有一蹴而就,都是持之以恒的,正所谓活到老学到老,真正懂得学习的人,才不会被这个时代的洪流所淘汰。
一个人可以走的很快,但一群人才能走的更远。不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎扫码加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上前端开发知识点,真正体系化!**
由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新
如果你觉得这些内容对你有帮助,可以添加V获取:vip1024c (备注前端)
[外链图片转存中…(img-armjertW-1712954508325)]
最后
好了,这就是整理的前端从入门到放弃的学习笔记,还有很多没有整理到,我也算是边学边去整理,后续还会慢慢完善,这些相信够你学一阵子了。
做程序员,做前端工程师,真的是一个学习就会有回报的职业,不看出身高低,不看学历强弱,只要你的技术达到应有的水准,就能够得到对应的回报。
学习从来没有一蹴而就,都是持之以恒的,正所谓活到老学到老,真正懂得学习的人,才不会被这个时代的洪流所淘汰。
一个人可以走的很快,但一群人才能走的更远。不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎扫码加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
[外链图片转存中…(img-6YRTMn8W-1712954508326)]