金山WPS web前端笔试题
JS基础和数据结构+算法,然而老夫没怎么复习数据结构,结果考了个图,现在很忧伤
1.
var a =[];
a['a'] =1;console.log(a.length);
a['2'] =2;
console.log(a.length);
a.length = 0;
console.log(a);
2、for(var i =0;i<5;i++){
//代码,每隔一秒输出,0到4,考闭包
}
3、function g(){
return 23;
}
typeof g()?
4.
var a = new String('A');
function showCase(data){
switch(data){
case 'A':
console.log(1);
break;
//中间还有一堆,我省略了
default:
console.log(5);
}
}
showCase(a);
5.js写一个map数据结构,要求只能用接口访问属性;
6.算法题,给个数组和一个数,如果数组里有两个数的和等于给定的数,返回true。要求复杂度是O(n);
#西山居##笔试题目##面经#