姓名: 部门:

本卷共有60道选择题,每题两分,上限120分。

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60

1. 对center类添加下面哪组样式不能实现div的水平居中 C

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Document</title>
  6. <style>
  7. .center {
  8. width: 200px;
  9. height: 100px;
  10. background-color: red;
  11. }
  12. </style>
  13. </head>
  14. <body>
  15. <div class="center"></div>
  16. </body>
  17. </html>
  • A: margin: 0 auto;
  • B: position: relative; left: 50%; margin-left: -100px;
  • C: position: relative; right: -50%; margin-left: 100px;
  • D: position: absolute; right: 50%; transform: translateX(50%);

2. div1和div2的content(内容)宽度分别是 D

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        .div1, .div2 {
            width: 120px;
            height: 100px;
            margin: 10px;
            padding: 10px;
            border: 10px solid;
        }

        .div2 {
            box-sizing: border-box;
        }
    </style>
</head>
<body>
    <div class="div1"></div>
    <div class="div2"></div>
</body>
</html>
  • A: 80px 120px
  • B: 100px 80px
  • C: 100px 100px
  • D: 120px 80px

3. 下列有关border:none和border:0的区别,描述错误的是? C

  • A: border:none表示边框样式无
  • B: border:0 表示边框宽度0
  • C: 当定义了border:none,即隐藏了边框的显示,实际就是边框宽度为0
  • D: 当定义边框时,仅设置border-width和border-type也可以达到显示的效果

4. 下面哪一个值不属于布局的可选值 D

  • A: block
  • B: inline
  • C: grid
  • D: sticky

5. 下面哪个属性不会让 div 脱离文档流(normal flow)?C

  • A: position: absolute;
  • B: position: fixed;
  • C: position: relative;
  • D: float: left;

6. span元素中文字的颜色是 C

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        span .span {
            color: blue;
        }
    </style>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="div">
        <span class="span">TEST</span>
    </div>
</body>
</html>

style.css:

.span {
    color: black;
}
.span {
    color: green;
}
.div {
    color: red;
}
  • A: red
  • B: blue
  • C: green
  • D: black

7. 对于CSS样式优先级,下面说法错误的是 C

  • A: ID选择器优先级高于类选择器
  • B: 权重相同的情况下,样式遵循就近优先原则
  • C: 外联样式表优先级大于内联样式表
  • D: 关系选择符( +, >, ~, ‘ ‘)对优先级没有影响

8. 对于display:none和visibility:hidden,下面描述不正确的是 D

  • A: 两者都可以让目标不可见
  • B: display:none不占据任何空间
  • C: visibility:hidden在文档中保留元素的空间
  • D: display:none的元素会从HTML文档中移除

9. 下面哪种存储方式不是HTML5新增 D

  • A: localStorage
  • B: sessionStorage
  • C: WebSQL
  • D: cookie

10. 下面哪个元素是空元素 A

  • A: input
  • B: style
  • C: div
  • D: ul

11. 下面代码的输出是什么 A

12..toFixed(2);
  • A: 12.00
  • B: 12
  • C: 0012
  • D: SyntaxError

12. 下面符合一个有效的Javascript变量定义规则的是? A

  • A: _$te$t2
  • B: with
  • C: a bc
  • D: 2a

13. 下面代码的输出是什么? D

function sayHi() {
  console.log(name);
  console.log(age);
  var name = "Lydia";
  let age = 21;
}

sayHi();
  • A: Lydiaundefined
  • B: LydiaReferenceError
  • C: ReferenceError21
  • D: undefinedReferenceError

14. 下面代码的输出是什么? C

for (var i = 0; i < 3; i++) {
  setTimeout(() => console.log(i), 1);
}

for (let i = 0; i < 3; i++) {
  setTimeout(() => console.log(i), 1);
}
  • A: 0 1 2 and 0 1 2
  • B: 0 1 2 and 3 3 3
  • C: 3 3 3 and 0 1 2
  • D: 3 3 3 and 3 3 3

15. 下面代码的输出是什么? B

const shape = {
  radius: 10,
  diameter() {
    return this.radius * 2;
  },
  perimeter: () => 2 * Math.PI * this.radius
};

console.log(shape.diameter(), shape.perimeter());
  • A: 20 62.83185307179586
  • B: 20 NaN
  • C: 20 63
  • D: NaN 63

16. 下面代码的输出是什么? A

+true;
!"Lydia";
  • A: 1 and false
  • B: 1 and true
  • C: false and NaN
  • D: false and false

17. 哪个选项是不正确的? A

const bird = {
  size: "small"
};

const mouse = {
  name: "Mickey",
  small: true
};
  • A: mouse.bird.size
  • B: mouse[bird.size]
  • C: mouse[bird["size"]]
  • D: 以上都是错的

18. 下面代码的输出是什么? B

let c = { greeting: "hi!" };
let d;

d = c;
c.greeting = "Hello";
console.log(d.greeting);
  • A: hi!
  • B: Hello
  • C: undefined
  • D: TypeError

19. 下面代码的输出是什么? C

let a = 3;
let b = new Number(3);
let c = 3;

console.log(a == b);
console.log(a === b);
console.log(b === c);
  • A: true false true
  • B: false false true
  • C: true false false
  • D: false true true

20. 下面代码的输出是什么? A

let greeting;
greetign = {}; // 敲错了!
console.log(greetign);
  • A: {}
  • B: ReferenceError: greetign is not defined
  • C: undefined
  • D: null

21. 当我们这样做时会发生什么? A

function bark() {
  console.log("Woof!");
}

bark.animal = "dog";
  • A: 一切正常。
  • B: SyntaxError. 你不能往函数上随意新增属性。
  • C: undefined
  • D: ReferenceError

22. 事件传播的三个阶段是什么?D

  • A: 目标 > 捕获 > 冒泡
  • B: 冒泡 > 目标 > 捕获
  • C: 目标 > 冒泡 > 捕获
  • D: 捕获 > 目标 > 冒泡

23. 下面代码的输出是什么? C

function sum(a, b) {
  return a + b;
}

sum(1, "2");
  • A: NaN
  • B: TypeError
  • C: "12"
  • D: 3

24. 下面代码的输出是什么? A

var time = new Date('2019/1/1 00:00:00');
time.setDate(-1);
console.log(time.toLocaleDateString());
  • A: '2018/12/30'
  • B: '2018/12/31'
  • C: '2019/1/0'
  • D: '2019/1/1'

25. 下面代码的输出是什么? B

let number = 0;
console.log(number++);
console.log(++number);
console.log(number);
  • A: 0 1 2
  • B: 0 2 2
  • C: 1 1 2
  • D: 1 2 2

26. 下面代码的输出是什么? C

function checkAge(data) {
  if (data === { age: 18 }) {
    console.log("You are an adult!");
  } else if (data == { age: 18 }) {
    console.log("You are still an adult.");
  } else {
    console.log(`Hmm.. You don't have an age I guess`);
  }
}

checkAge({ age: 18 });
  • A: You are an adult!
  • B: You are still an adult.
  • C: Hmm.. You don't have an age I guess

27. 下面代码的输出是什么? C

function getAge(...args) {
  console.log(typeof args);
}

getAge(21);
  • A: "number"
  • B: "array"
  • C: "object"
  • D: "NaN"

28. 下面代码的输出是什么? A

const sum = eval("10*10+5");
  • A: 105
  • B: "105"
  • C: TypeError
  • D: "10*10+5"

29. 下面代码的输出是什么? B

var num = 8;
var num = 10;
console.log(num);
  • A: 8
  • B: 10
  • C: SyntaxError
  • D: ReferenceError

30. 下面代码的输出是什么? C

const obj = { 1: "a", 2: "b", 3: "c" };
const set = new Set([1, 2, 3, 4, 5]);

obj.hasOwnProperty("1");
obj.hasOwnProperty(1);
set.has("1");
set.has(1);
  • A: false true false true
  • B: false true true true
  • C: true true false true
  • D: true true true true

31. 下面代码的输出是什么? C

for (let i = 1; i < 5; i++) {
  if (i === 3) continue;
  console.log(i);
}
  • A: 1 2
  • B: 1 2 3
  • C: 1 2 4
  • D: 1 3 4 5

32. 下面代码的输出是什么? A

const name = "Lydia";

String.prototype.giveLydiaPizza = () => {
  return "Just give Lydia pizza already!";
};

name.giveLydiaPizza();
  • A: "Just give Lydia pizza already!"
  • B: TypeError: not a function
  • C: SyntaxError
  • D: undefined

33. 下面代码的输出是什么? D

function showEventCircle() {
    console.log('first');
    Promise.resolve(console.log('second')).then(() => {
        console.log('third');
        setTimeout(()=>{console.log('fourth');});
    });
    setTimeout(()=>{console.log('fifth');});
    console.log('sixth');
}
showEventCircle();
  • A: first second third fourth fifth sixth
  • B: first second sixth third fourth fifth
  • C: first second third sixth fourth fifth
  • D: first second sixth third fifth fourth

34. 单击按钮时 event.target 是什么? C

<div onclick="console.log('first div')">
  <div onclick="console.log('second div')">
    <button onclick="console.log('button')">
      Click!
    </button>
  </div>
</div>
  • A: div外部
  • B: div内部
  • C: button
  • D: 所有嵌套元素的数组.

35. 单击下面的 html 片段打印的内容是什么? C

<div onclick="console.log('div')">
  <p onclick="console.log('p')">
    Click here!
  </p>
</div>
  • A: p
  • B: div
  • C: p div
  • D: div p

36. 下面代码的输出是什么? B

function sayHi() {
  return (() => {return 0;})();
}

typeof sayHi();
  • A: "object"
  • B: "number"
  • C: "function"
  • D: "undefined"

37. 下面这些值哪些是假值? A

0;
new Number(0);
("");
(" ");
new Boolean(false);
undefined;
  • A: 0, '', undefined
  • B: 0, new Number(0), '', new Boolean(false), undefined
  • C: 0, '', new Boolean(false), undefined
  • D: 所有都是假值

38. 下面代码的输出是什么? B

console.log(typeof typeof 1);
  • A: "number"
  • B: "string"
  • C: "object"
  • D: "undefined"

39. 下面代码的输出是什么? C

const numbers = [1, 2, 3];
numbers[10] = 11;
console.log(numbers);
  • A: [1, 2, 3, 11]
  • B: [1, 2, 3, 7 x null, 11]
  • C: [1, 2, 3, 7 x empty, 11]
  • D: SyntaxError

40. 下面代码的输出是什么? A

(() => {
  let x, y;
  try {
    throw new Error();
  } catch (x) {
    (x = 1), (y = 2);
    console.log(x);
  }
  console.log(x);
  console.log(y);
})();
  • A: 1 undefined 2
  • B: undefined undefined undefined
  • C: 1 1 2
  • D: 1 undefined undefined

41. JavaScript 中的所有内容都是 A

  • A:原始类型或对象
  • B:函数或对象
  • C:对象
  • D:数字或对象

42. 下面代码的输出是什么? C

[[0, 1], [2, 3]].reduce(
  (acc, cur) => {
    return acc.concat(cur);
  },
  [1, 2]
);
  • A: [0, 1, 2, 3, 1, 2]
  • B: [6, 1, 2]
  • C: [1, 2, 0, 1, 2, 3]
  • D: [1, 2, 6]

43. 下面代码的输出是什么? B

!!null;
!!"";
!!1;
  • A: false true false
  • B: false false true
  • C: false true true
  • D: true true false

44. setInterval方法的返回值什么? A

setInterval(() => console.log("Hi"), 1000);
  • A:一个唯一的id
  • B:指定的毫秒数
  • C:传递的函数
  • D:undefined

45. 下面代码的返回值是什么? A

[..."Lydia"];
  • A: ["L", "y", "d", "i", "a"]
  • B: ["Lydia"]
  • C: [[], "Lydia"]
  • D: [["L", "y", "d", "i", "a"]]

46. 下面代码的返回值是什么?C

function doError() {
    try {
        throw 'try';
    } catch (e) {
        throw 'catch';
    } finally {
        return 'finally';
    }
    return 'do';
}
doError();
  • A: try
  • B: catch
  • C: finally
  • D: do

47. 下面的代码返回值是什么?C

class Circle {
  constructor(radius) {
    this.radius = radius;
    this.perimeter = ()=>2*Math.PI*this.radius;
  }
  diameter() {
    return this.radius * 2;
  }
  toString() {
    return '(' + this.radius + ')';
  }
}

var cir1 = new Circle(10);
var {diameter} = cir1;
var {perimeter} = cir1;
diameter();
perimeter();
  • A: 20 62.83185307179586
  • B: 62.83185307179586 20
  • C: TypeError 62.83185307179586
  • D: 20 TypeError

48. 下面代码的输出是什么? B

const a = {};
const b = { key: "b" };
const c = { key: "c" };

a[b] = 123;
a[c] = 456;

console.log(a[b]);
  • A: 123
  • B: 456
  • C: undefined
  • D: ReferenceError

49. 以下关于跨域说法错误的是?D

  • A: Cookie,LocalStorage和IndexedDB都会受到同源策略的限制
  • B: postMessage,JSONP,WebSocket都是常用的解决跨域的方案
  • C: 跨域资源共享规范中规定了除了GET之外的HTTP请求,或者搭配某些MINE类型的POST请求,浏览器都需要先发一个OPTIONS请求
  • D: www.christophero.com和https://www.christophero.com是相同的域名,属于同源

50. 下面哪几个和 http://store.company.com/dir/page.html 符合同源策略?A

51. 下列选项中,属于”10.174.20.176/28”该网段的有效IP地址是?B

  • A: 10.174.20.174
  • B: 10.174.20.186
  • C: 10.174.20.192
  • D: 10.174.20.196

52. 下面代码的输出是什么? A

[1 < 2 < 3, 3 < 2 < 1]
  • A: [true, true]
  • B: [true, false]
  • C: [false, true]
  • D: [false, false]

53. 下面代码的输出是什么? A

function setname(name){
 this.name = name
}
setname.prototype.printName = function(){ console.log(this.name) }
let a = new setname("cc")
a.name = "dd"
a.__proto__.name = "ee"

a.__proto__.printName()  // ?
a.printName() // ?
  • A: ee dd
  • B: cc dd
  • C: ee cc
  • D: ee Error

54. 新窗口打开网页,用到下面哪个值 B

  • A: _self
  • B: _blank
  • C: _top
  • D: _parent

55. 在表格中添加一行tr,下面哪种做法是可行的。A

<table>
  <tr><td>列1</td><td>列2</td></tr>
</table>
  • A: $(‘tr’).clone().appendTo($(‘tbody’))
  • B: $(‘tr’).clone().insertAfter($(‘tbody’))
  • C: $(‘tbody’).append($(‘tr’));
  • D: $(‘tr’).after($(‘tbody’));

56. 使用jquey从DOM中删除所有匹配的元素,下面哪一个是正确的? C

  • A: delete()
  • B: empty()
  • C: remove()
  • D: removeAll()

57. 以下哪个选项不能够正确地得到这个标签? B

<input id="btnGo"type="button" value="点击" class="btn">
  • A: $(‘#btnGo’)
  • B: $(‘input:contains(点击)’)
  • C: $(‘.btn’)
  • D: $(‘input[type=”button”]’)

58. Vue中获取动态路由{ path: ‘/user/:id’ }中id的值正确的是: A

  • A: this.$route.params.id
  • B: this.route.params.id
  • C: this.$router.params.id
  • D: this.router.params.id

59. Vue的生命周期,执行顺序正确的是?C

  • A: beforeCreate -> init->create->mount->destory
  • B: mount-> init->beforeCreate->create->destory
  • C: beforeCreate->create->init->mount->destory
  • D: init->beforeCreate->create->mount->destory

60. 以下对Vue的双向绑定说法不正确的是? D

  • A: 采用数据劫持结合发布者-订阅者模式的方式
  • B: 通过Object.defineProperty()来劫持各个属性的setter,getter,在数据变动时发布消息给订阅者,触发相应监听回调
  • C: MVVM作为数据绑定的入口,整合Observer,Compile和Watcher三者,通过Observer来监听自己的model的数据变化
  • D: Vue是通过基于脏检查机制实现双向绑定

01-10 CDCDC CCDDA
11-20 AADCB AABCA
21-30 ADCAB CCABC
31-40 CADCC BABCA
41-50 ACBAA CCBDA
51-60 BAABA CBACD