51信用卡前端笔试题

来源:互联网 发布:数据挖掘外文书籍推荐 编辑:程序博客网 时间:2024/04/30 05:22

回忆一下几道有价值的题目吧:

1 写一个能够往超类型构造函数传参的原生JS继承

要求能够往超类型构造函数传参:

function People(name, age) {    this.name = name;    this.age = age;}People.prototype.say = function() {    console.log(this.name);    console.log(this.age);}function Man(name, age, father) {    People.call(this, name, age);    this.father = father;}Man.prototype = new People();Man.prototype.constructor = Man;Man.prototype.sex = 'male';Man.prototype.say = function() {    console.log(this.name);// zy    console.log(this.age);//12    console.log(this.sex);//male    console.log(this.father);//achao}var m1 = new Man('zy', 12, 'achao');m1.say();

相关知识点可以去看《JS高程》

或者看博主我的读书笔试:

《JS高级程序设计》第6章读书笔记:继承对象(二)借用构造函数和组合继承

2 如果一个JS函数没有return表达式,那么它会返回什么?

答案是undefined。

虽然没有返回值,但是返回值是必须的,因为:

At some very low level, the return is translated into some sort of jump. If a function really returned nothing at all, there would be no way of knowing what and when to call the next function, or to call event handlers and the like.

So to recap: No, a JS function needn’t return anything as far as your code goes. But as far as the JS engines are concerned: a function always returns something, be it explicitly via a return statement, or implicitly. If a function returns implicitly, its return value will always be undefined.

详见:Does every Javascript function have to return a value?

3 下列一些函数哪些不会改变原有数组

  • sort
  • concat
  • push

很简单,选concat

4 考察dd、dl、dt

The HTML dl element represents a description list. The element encloses a list of groups of terms and descriptions. Common uses for this element are to implement a glossary or to display metadata (a list of key-value pairs).

<dl>  <dt>Firefox</dt>  <dt>Mozilla Firefox</dt>  <dt>Fx</dt>  <dd>    A free, open source, cross-platform,    graphical web browser developed by the    Mozilla Corporation and hundreds of    volunteers.  </dd>  <!-- Other terms and descriptions --></dl>
Firefox
Mozilla Firefox
Fx
A free, open source, cross-platform, graphical web browser developed by the Mozilla Corporation and hundreds of volunteers.

5 死锁产生的原因

直接看维基百科吧:

死锁

6 考察一些HTTP header的字段

age:

“Age: 0” HTTP Header

Etag

The ETag HTTP response header is an identifier for a specific version of a resource. It allows caches to be more efficient, and saves bandwidth, as a web server does not need to send a full response if the content has not changed. On the other side, if the content has changed, etags are useful to help prevent simultaneous updates of a resource from overwriting each other (“mid-air collisions”).

If the resource at a given URL changes, a new Etag value must be generated. Etags are therefore similar to fingerprints and might also be used for tracking purposes by some servers. A comparison of them allows to quickly determine whether two representations of a resource are the same

7 考察JS正则表达式

考察\d , ^的含义。

原创粉丝点击