前端每日一題#08

關注公眾號 前端人,回復“加群”
添加無廣告優(yōu)質學習群
昨日前端每日一題#07
請選擇下列代碼的輸出結果( )?
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()
A、2,1,3
B、1,2,3
C、2,3,1
答案:B
今日題目
請選擇下列代碼的輸出結果( )
var a = 1;
function Fn1() {
var a = 2;
console.log(this.a + a);
}
function Fn2() {
var a = 10;
Fn1();
}
Fn2();
var Fn3 = function () {
this.a = 3;
};
Fn3.prototype = {
a: 4,
};
var fn3 = new Fn3();
Fn1.call(fn3);
A.錯誤
B.3,3
C.2,10
D.3,5
玩法介紹
評論區(qū)給出你的答案,并且?guī)兔c個在看,每天的每日一題答案由下一天給出,歡迎參與每日一題,一周連續(xù)答對5題者,周六鬼哥抽取送愛奇藝會員一個
題庫小程序
回復 資料包領取我整理的進階資料包回復 加群,加入前端進階群console.log("文章點贊===文章點在看===你我都快樂")Bug離我更遠了,下班離我更近了
評論
圖片
表情
