1번 - What message will eventually be alerted? After how long?
var name = "Window";
var alice = {
name: "Alice",
sayHi: function() {
alert(this.name + " says hi");
}
};
var bob = { name: "Bob" };
setTimeout(function() {
alice.sayHi();
}, 1000);
1번 질문의 답을 선택하세요. *
Window says hi, after 1 second
Window says hi, immediately
Alice says hi, after 1 second
Alice says hi, immediately
Bob says hi, after 1 second
Bob says hi, immediately
2번 - What message will eventually be alerted? After how long?
var name = "Window";
var alice = {
name: "Alice",
sayHi: function() {
alert(this.name + " says hi");
}
};
var bob = { name: "Bob" };
setTimeout(alice.sayHi, 1000);
setTimeout(function() {
alert(this.name + " says hi");
}, 1000); // 실행될때의 this결정
2번 질문의 답을 선택하세요. *
Window says hi, after 1 second
Window says hi, immediately
Alice says hi, after 1 second
Alice says hi, immediately
Bob says hi, after 1 second
Bob says hi, immediately
3번 - What message will eventually be alerted? After how long?
var name = "Window";
var alice = {
name: "Alice",
sayHi: function() {
alert(this.name + " says hi");
}
};
var bob = { name: "Bob" };
setTimeout(alice.sayHi.bind(alice), 1000);
3번 질문의 답을 선택하세요. *
Window says hi, after 1 second
Window says hi, immediately
Alice says hi, after 1 second
Alice says hi, immediately
Bob says hi, after 1 second
Bob says hi, immediately
4번 - What message will eventually be alerted? After how long?
var name = "Window";
var alice = {
name: "Alice",
sayHi: function() {
alert(this.name + " says hi");
}
};
var bob = { name: "Bob" };
setTimeout(alice.sayHi(), 1000);
4번 질문의 답을 선택하세요. *
Window says hi, after 1 second
Window says hi, immediately
Alice says hi, immediately
Alice says hi, after 1 second
Bob says hi, immediately
Bob says hi, after 1 second
5번 - What message will eventually be alerted? After how long?
var name = "Window";
var alice = {
name: "Alice",
sayHi: function() {
alert(this.name + " says hi");
}
};
var bob = { name: "Bob" };
setTimeout(alice.sayHi.bind(bob), 1000);
5번 질문의 답을 선택하세요. *
Window says hi, after 1 second
Window says hi, immediately
Alice says hi, after 1 second
Alice says hi, immediately
Bob says hi, after 1 second
Bob says hi, immediately
6번 - What message will eventually be alerted? After how long?
var name = "Window";
var alice = {
name: "Alice",
sayHi: function() {
alert(this.name + " says hi");
}
};
var bob = { name: "Bob" };
setTimeout(alice.sayHi.call(bob), 1000);
6번 질문의 답을 선택하세요. *
Window says hi, after 1 second
Window says hi, immediately
Alice says hi, after 1 second
Alice says hi, immediately
Bob says hi, after 1 second
Bob says hi, immediately
7번 - What message will eventually be alerted? After how long?
var name = "Window";
var alice = {
name: "Alice",
sayHi: function() {
alert(this.name + " says hi");
}
};
var bob = { name: "Bob" };
bob.sayHi = alice.sayHi
bob.sayHi = function() {
alert(this.name + " says hi");
}
setTimeout(bob.sayHi, 1000);
7번 질문의 답을 선택하세요. *
Window says hi, after 1 second
Window says hi, immediately
Alice says hi, after 1 second
Alice says hi, immediately
Bob says hi, after 1 second
Bob says hi, immediately
8번 - What message will eventually be alerted? After how long?
var name = "Window";
var alice = {
name: "Alice",
sayHi: function() {
alert(this.name + " says hi");
}
};
var bob = { name: "Bob" };
var sayHi = alice.sayHi.bind(bob)
setTimeout(function () {
window.sayHi()
}, 1000);
8번 질문의 답을 선택하세요. *
Window says hi, after 1 second
Window says hi, immediately
Alice says hi, after 1 second
Alice says hi, immediately
Bob says hi, after 1 second
Bob says hi, immediately
9번 - What message will eventually be alerted? After how long?
var name = "Window";
var alice = {
name: "Alice",
sayHi: function() {
alert(this.name + " says hi");
}
};
var bob = { name: "Bob" };
alice.sayHi.bind(bob); // 리턴이 바로 사라져버림
setTimeout(alice.sayHi(), 1000);
9번 질문의 답을 선택하세요. *
Window says hi, after 1 second
Window says hi, immediately
Alice says hi, after 1 second
Alice says hi, immediately
Bob says hi, after 1 second
Bob says hi, immediately
'코드스테이츠(Immersive) > 체크포인트' 카테고리의 다른 글
Checkpoints 12 - Chatterbox Server (0) | 2019.08.14 |
---|---|
Checkpoints 10 - Order of Execution (0) | 2019.07.28 |
Checkpoints 09 - Value vs. Reference (0) | 2019.07.28 |
Checkpoints 08 - JavaScript Callbacks (0) | 2019.07.27 |
Checkpoints 04 - JS Prototypes(Object.create) (0) | 2019.07.24 |