Skip to content

Files

Latest commit

72adc0f · Apr 15, 2017

History

History
62 lines (50 loc) · 1.39 KB

README.md

File metadata and controls

62 lines (50 loc) · 1.39 KB

2017-04 WPS广州场笔试题分享与总结

声明:题解不代表最终答案,若有更好的实现方式或发现错误,请提PR更正

A,B,C分别输出什么?

var arr = [];  
arr['a'] = 1;  
console.log(arr.length); // A  
arr['2'] = 2;  
console.log(arr.length); // B  
arr.length = 0;  
console.log(arr); // C  

要求每隔1秒钟按顺序输出i值 题解

for (var i = 0; i < 5; i++) {  
    //在此处编写代码
}

如下代码运行结果是?

var f = function g() {
    return 23;
};
typeof g(); //输出什么

以下代码运行结果是什么?

function showCase(value) {
    switch (value) {
    case 'A':
        console.log(1);
        break;
    case 'string':
        console.log(2);
        break;
    case undefined:
        console.log(3);
        break;
    case 'undefined':
        console.log(4);
        break; 
    default:
        console.log(5);
        break;              
    }
}

showCase(new String('A'));

请用JavaScript实现map的数据结构,要求数据只能通过map提供的接口进行访问 题解

给定一个排好序的整数数组,判断其中是否存在两个数之和等于指定的值,时间复杂度最好能达到O(n)。例如:[1, 2, 3, 4, 5, 9], 指定值为12, 结果为true 题解