webveuje/考试/原题/js/js测试20210406.md
2021-04-29 17:16:40 +08:00

104 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# js 测试
## 选择题
1. 下面声明数组的方式错误的是
A. var arr=[]
B. var arr=new Array(7)
C.var arr=[{name:"asd",age:20"},{name:"asd",age:20"},{name:"asd",age:20"}]
D.var arr=[{name:"asd",age:20"},{name:"asd",age:20"},0]
答案 D
2. 下面哪个不是数组的方法
A.pop
B.shift
C.remove
D.push
答案C
3. 下面哪个遍历数组的方式是错的
A.
var arr = [1, 2, 3, 4, 5, 6]
for(var i = 0; i < arr.length; i++) {
console.log(arr[i])
}
B.
var arr = ['我', '', '', '', '', '']
for(var key in arr) {
console.log(key)
}
C.
var arr = ['我', '', '', '', '', '']
for(var key of arr) {
console.log(key)
}
D.
var arr = [1, 2, 3, 4, 5, 6]
var newArr = arr.map(function (item, idnex) {
return item * item
})
console.log(newArr)
## 填空题
1. 列举js事件类型至少五个
2. 检测NaN的数据类型结果为
3. 读代码写执行结果
```
function C1(name) {
if (name) {
this.name = name;
}
}
function C2(name) {
this.name = name;
}
function C3(name) {
this.name = name || 'join';
}
C1.prototype.name = 'Tom';
C2.prototype.name = 'Tom';
C3.prototype.name = 'Tom';
alert((new C1().name) + (new C2().name) + (new C3().name));
```
## 简答题
1. 写一个函数实现传入一个数组 实现冒泡排序
2. 数组去重多种方法实现
3. 写一个函数求传入数组的平均数
4.
在一个大学的编程选修课班里我们得到了一组参加该班级的学生数据分别是姓名性别年龄和年级接下来呢我们要利用JavaScript的知识挑出其中所有是大一的女生的的名字哦
学生信息如下
('小A','',21,'大一'), ('小B','',23,'大三'),
('小C','',24,'大四'), ('小D','',21,'大一'),
('小E','',22,'大四'), ('小F','',21,'大一'),
('小G','',22,'大二'), ('小H','',20,'大三'),
('小I','',20,'大一'), ('小J','',20,'大三')