第一套
1、请列举你所知道的H5和CSS3新特性,并着重描述你认为其中比较重要的3-5项
2、指出一下代码的问题、缺点并写出优化方案 function init(div){
var links = div.getElementsByTagName('a');
for(var i=0; i<links.length; i++){
var link = links[i];
link.style.fontWeight = 'bold';
link.style.textDecoration = 'none';
link.style.color = '#000';
link.onclick = function(){
alert(i);
}
}
}
3、请阅读一下程序并写出运行结果
var x = 30;
function test(x){
alert(x);
var x = 10;
alert(x);
x = 20;
function x() {};
alert(x);
} test(40);
4、写出以下程序的输出内容
var name = 'Rose';
function a(){
console.log(this);
}
var result1 = a.call(null);
var result2 = a.apply(undefined);
var obj = {
name: 'Jack',
getName: function(){
return this.name
}
};
var shortCut = obj.getName;
var result3 = shortCut();
console.log(result1, result2, result3);
5、请描述ajax请求的整体流程以及如何解决可能出现的跨域问题
6、请解释http状态码304的含义及产生的原因
7、有没有在项目中进行过性能优化实践?如果有,请详述方案:如果没有,请列举你能想到的一些技术手段
8、实现一个trim函数,去除字符串首尾的空格
9、实现compose函数,该函数参数为不限个数的函数,返回一个新的函数。返回的新函数执行效果为:参数中的函数从右到左依次执行,上一个函数返回结果作为下一个函数的参数,最终返回最后一个函数的结果。
如:(compose(f, h, g))()相当于 f(h(g()))
又如: var greet = function(name){return 'hi: ' + name};
var eclaim = function(statement){return statement.toUpperCase() + "!"; };
var welcome = _.compose(greet, exclaim); welcome('moe');
//hi: MOE!
10、实现replace函数,将一个字符串中的片段替换成另一个片段,如: replace('hello hello world', 'hello', 'hey') //hey hey world
replace('you are the one, you are the best', 'you are', 'i am') //i am the one, i am the best
第二套
CSS篇
1、BFC是什么?
2、Doctype的作用?严格模式与混杂模式的区别?
3、IE的双边距BUG:块级元素float后设置横向margin,IE6显示的margin比设置的较大
4、CSS优先级算法如何计算?
JS篇
1、列举3中强制类型转换和2种隐式类型转换?
2、IE和标准有哪些兼容性的写法?
3、JavaScript的同源策略
4、看代码给答案
var a = new Object();
a.value = 1;
b = a;
b.value = 2;
alert(a.value);
第三套
1、将下面对象数组去重
const responselist = [
{id: 1, a: 1},
{id: 2, a: 2},
{id: 3, a: 3},
{id: 1, a: 4}
]
2、forEach,map和filter的区别
3、写出几种判断数据类型的方法
4、vue中循环遍历:key有什么作用
5、vue双向绑定的原理是什么?如何解除双向绑定
第四套
1、写出以下控制台输出结果与值类型
(1) console.log(1 + 2 + '3')
(2) console.log('3' + 2 + 1)
(3) console.log(+ '3' + 2 + 1)
(4) console.log(1 + '2' + '3')
(5) console.log('A' - 'B' + 'C')
(6) console.log(0 && 2 || 1)
(7) var a = 0.1, b = a+++a, c = a-+b; console.log(a, b, c)
2、写出以下代码在控制台的输出结果
(fuction(){
var a = b = 9;
})()
console.log(a);
console.log(b);
3、编写函数sum,使其按如下调用皆能正常运行
consoe.log(sum(2, 3)); //输出5
console.log(sum(2)(3)); //输出5
4、实现数组的倒排以及降序排列
var numberArray = [3, 6, 2, 4, 1, 5];
倒排结果:[5, 1, 4, 2, 6, 3];
降序结果:[6, 5, 4, 3, 2, 1];
5、编写提取Url参数的函数,按key-value形式捋结果存储到json结构中返回url示例:http://www/AAAAAA.com/project/item/list.html?a=1&b=2&c=&d=xxx&e
6、下面代码返回什么?解释一下
console.log((fuction f(n){return ((n > 1) ? n * f(n - 1) : n)})(10));
第五套