Skip to content

Instantly share code, notes, and snippets.

@a-x-
Last active November 14, 2017 15:52
Show Gist options
  • Save a-x-/97fb940192d684c92312182f6cef40c5 to your computer and use it in GitHub Desktop.
Save a-x-/97fb940192d684c92312182f6cef40c5 to your computer and use it in GitHub Desktop.
js interview questions: event loop, interview, es6-ZHEST'
// event loop
console.log(1);
setTimeout(() => console.log(2), 0);
console.log(3);
// closure
for (var i = 0; i < 3; i++) {
setTimeout(() => console.log(i), 0)
}
// es6-ZHEST'
class Test {
test() {
const a = () => console.log(this)
const b = function () { console.log(this) }
const A = { a, b }
const c = A.a
const d = A.b
a()
b()
A.a()
A.b()
c()
d()
}
}
(new Test).test()
//(new Test).test.call()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment