Skip to content

Instantly share code, notes, and snippets.

@crongro
Created May 24, 2018 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crongro/d737480fa02d10dfff577c4ca7005632 to your computer and use it in GitHub Desktop.
Save crongro/d737480fa02d10dfff577c4ca7005632 to your computer and use it in GitHub Desktop.
debugging test
//2초뒤에 'codesquad'가 출력되도록 코드를수정하세요. (출력은 printMyname을 통해서 할 수 있음)
//(a,b객체를 직접 부를 수 없음. bind,call 등을 사용해야 함)
const a = {
run() {
setTimeout( ()=> {
const name = this.getName();
},1000);
}
}
const b = {
start(printMyname) {
setTimeout(function(){
a.run();
},1000);
},
getName() {
return 'codesquad'
}
}
const printMyname = (name) => console.log(name);
b.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment