搜索整理的面试题
1、js中使用replace正则匹配的方法去除字符串左空格
2、写出5个js字符串操作函数并注明功能
3、如何新建一个obj对象,可执行obj.a().b().a() // 原则上可无限调用
4、数组方法slice()和splice()的区别
5、 typeof null
typeof Symbol()
typeof undefined
6、 let a = 0;
if([]){
a = a+1;
}
if([] == true){
a = a+2;
}
if(![] === false){
a = a+3;
}
console.log(a++ +' : '+ ++a)
7、如何解决vue首屏加载慢的问题
8、简述Vue中is、ref、key的特性
9、vue-cli如何创建自定义指令
10、如何解决不同浏览器的样式兼容性问题
11、简述如何防御CSFR
12、对于生命周期的理解
13、var arr = ['1', '2', '3'];
var r = arr.map(parseInt);
console.log(r); _________
var m = arr.map(x=>parseInt(x));
console.log(m); _________
14、填写该行输出内容
function Parent() {
this.name = 'parent';
}
Parent.prototype.say = function () {
console.log('say');
};
function Child(age) {
Parent.call(this);
this.age = age;
}
var p = new Parent();
p.say(); _______
var c = new Child(12);
c.say(); _______
15、function A() {
this.name = 'a'
this.color = ['green', 'yellow']
}
function B() {
}
B.prototype = new A()
var b1 = new B()
var b2 = new B()
b1.name = 'change'
b1.color.push('black')
console.log(b1.name)
console.log(b2.name)
console.log(b1.color)
console.log(b2.color)
新增
1. 声明提升
2. 路由拦截器和接口拦截器
3. 两个组件使用vuex state的同一个参数,数据会同步,但vuex中的内容不会更改。vuex中数据修改的唯一途径就是通过mutations,actions只是异步获取数据,提交给mutations