面试字节

2020-05-11  本文已影响0人  kzc爱吃梨
function Person(name) {
  this.name = name;
}

Person.prototype.print = function() {
  return this.name;
};

Person('abc');
const a = new Person('abc').print.call({});
console.log(a);

const fn = () => {
  this.x = 'z';
};

const b = {x: 'y'};
fn.call(b);
console.log(b);

2.垂直居中

function Person(name) {
  this.name = name;
}

Person.prototype.print = function() {
  return this.name;
};

Person('abc');
const a = new Person('abc').print.call({});
console.log(a);

const fn = () => {
  this.x = 'z';
};

const b = {x: 'y'};
fn.call(b);
console.log(b);
flat 

[1,2,3,4,[5,6,7,[8,9]]]

[1,2,3,4,5,6,7,8,9]

function flat(arr) {
 return result 
}

5.Promise

上一篇 下一篇

猜你喜欢

热点阅读