希望可以为各位同学查缺补漏、温故知新,不希望前端学习最后成为"应试教育"
请通过提交Issue
的方式来分享你的面试题。
前端面试题大合集
希望可以为各位同学查缺补漏、温故知新,不希望前端学习最后成为"应试教育"
请通过提交Issue
的方式来分享你的面试题。
请描述一下Vue的双向绑定原理
使用原生JS实现一个Promise
。
至少包括以下三点:
Promise
的构造函数Promise.prototype.then
Promise.prototype.catch
方法描述一下在Vue中,父子组件是如何通信的?包括父组件如何与子组件通信,子组件如何和父组件通信
实现一个方法Promise.total(Array<Promise>)
。它接受的参数是由多个Promise实例构成的数组,返回值仍然是一个Promise实例。这个promise所resolve的值是传入的Array<Promise>
所有结果,返回格式如下:
[
{
// 成功情况下,success为true,data为promise实例的决议值
success: true,
data: 'resolved data'
},
{
// 失败情况下,success为false,data为promise实例的决绝原因
success: false,
data: 'rejected reason'
}
]
Promise.total([
Promise.resolve('p1'),
Promise.reject('p2'),
Promise.resolve('p3')
]).then(resultList => {
// 这里输出的是
// [
// {
// success: true,
// data: 'p1'
// },
// {
// success: false,
// data: 'p2'
// },
// {
// success: true,
// data: 'p3'
// }
// ]
console.log(resultList);
});
假设需要实现一个日报邮件定时推送功能,日报需要分别获取三个接口的数据,分别为订单总数、优惠券发放总数、会员总数,现在要求三个接口并发请求,三个接口都请求完成后将数据拼装并发送日报,可能会出现有接口请求失败的情况,如果失败则忽略失败数据,只发送成功获取的数据。
如下面代码,foo定义在data中,bar定义在computed中,foo与bar有什么不同
{
data: function() {
return {
foo: 'hellow'
}
},
computed: {
bar: function() {
return this.foo + ' world';
}
}
}
描述一下Vue中的mixin与extend的区别
请描述在Vue中,兄弟组件是如何通信的?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.