xx科技2023前端开发卷B

xx科技2023前端开发卷B

选择题

  1. 考察css文本属性
  2. 考察Html5新增标签
  3. 考察JavaScript基本数据类型有哪些
  4. https端口号
  5. 看代码得结果
setTimeout(()=>{
    console.log(4)
})

new Promise(resolve=>{
    resolve()
    console.log(1);
}).then(()=>{
    console.log(3);
})

cnosle.log(2)

1,2,3,4

  1. 考察对虚拟DOM的理解

  2. 考察引用类型的传值方式

var a,b,c;
a = [1,7];
b = a;
b[0] = 6;
c = b;
c[1] = 9;
console.log(a)

这里数组是引用数据类型,画个图方便理解:

js中引用数据类型的传值

  1. 双等号判断值是否返回true

这个在xx技术2023前端开发卷A第29题。

  1. 看代码,写结果:
Function.prototype.before = function (beforeFn) {
  return () => {
    beforeFn.apply(this, arguments)
    return this.apply(this, arguments)
  }
}

Function.prototype.after = function (afterFn) {
  return () => {
    var ret = this.apply(this, arguments);
    afterFn.apply(this, arguments)
    return ret
  }
}

func = function () {
  console.log(2);
}.before(function () {
  console.log(1);
}).after(function () {
  console.log(3);
})

func();

1,2,3

  1. 考察Object.keys(obj),Object.getOwnPropertyNames(obj),Relfect.ownKeys(obj)三者的区别。
var obj = { a: "1", b: "2" };
Object.prototype.protoName = "proto foobar";
var foo = Symbol("foo");
// 给obj 添加了一个键名为 c, foo 变量值
Object.defineProperty(obj, "c", {
  value: "3",
  enumerable: false  // 定义是否可枚举,默认 false
})
Object.defineProperty(obj, "d", {
  value: "4",
  enumerable: true  // 定义是否可枚举
})
Object.defineProperty(obj, foo, {
  value: "foobar",
  enumerable: false
});

console.log("Object.keys(obj): ", Object.keys(obj));  // ["a", "b", "d"]
console.log("Object.getOwnPropertyNames(obj): ", Object.getOwnPropertyNames(obj));  // ["a", "b", "c", "d"]
console.log("Relfect.ownKeys(obj): ", Reflect.ownKeys(obj)); // [Symbol(foo)]

编程题

  1. 盒子垂直水平居中的方法(盒子高度宽度不能设置)

这部分的内容,看我之间的博客盒子水平垂直居中的方法,这部分的内容在该文章的最后,盒子居中章节。

  1. 使用正则写一个符合要求的身份证号,要求时间从1900-2022,月份1-12,日期1-31.校验位匹配大小写以及字符.

1900-2022身份证号

  1. 深拷贝的方式

之间的文章里有,深拷贝

posted @ 2022-09-14 10:16  抗争的小青年  阅读(21)  评论(0编辑  收藏  举报