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
网友评论