Skip to content

Instantly share code, notes, and snippets.

@jhickey
jhickey / this.js
Last active February 13, 2018 13:57
//What does `this` refer to in each context?
/********************************************************************************/
console.log(this);
/********************************************************************************/
var obj = {
subObj: {
@jhickey
jhickey / async.js
Last active February 13, 2018 13:57
function first() {
console.log('foo');
setTimeout(function() { console.log('bar'); }, 1000);
setTimeout(function() { console.log('baz'); }, 0);
console.log('qux');
}
//In what order do the console statements above print?
first();