Skip to content

Instantly share code, notes, and snippets.

View jonathanhawleypeters's full-sized avatar

Jonathan Hawley-Peters jonathanhawleypeters

View GitHub Profile
Day Amount
Monday $5
Tuesday $7
Wednesday $10
Thursday $5
Friday $8
Saturday $15
Sunday $8
Monthly remainder ~$42
@jonathanhawleypeters
jonathanhawleypeters / this_keyword_useful_in_setInterval.js
Created July 1, 2017 00:31
This is Why I Love Fat Arrow Functions in ES6 #3
var Cat = function() {
this.name = ‘Fluffball’;
this.emote = ‘meow’;
setInterval(()=>{
console.log(this.emote);
}, 2000)
};
var myNewCat = new Cat(); //meow, meow, meow… every 2 seconds ad infinitum
@jonathanhawleypeters
jonathanhawleypeters / arrow_function_on_prototype.js
Created July 1, 2017 00:28
This is Why I Love Fat Arrow Functions in ES6 #2
Cat.prototype.readCollar = () => {
console.log(this.name); 
//undefined at call time, 'this' is bound to the global scope
};
@jonathanhawleypeters
jonathanhawleypeters / fat_arrow_vs_regular_function.js
Created July 1, 2017 00:25
This is Why I Love Fat Arrow Functions in ES6 #1
function() {
}
//becomes
() => {
}