This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Create a function that accepts a function and then | |
* fires only after it hasn't been called for 250ms | |
* | |
* Once that is done, create an "exit" functionality | |
* that will take an "exit" number, higher than the | |
* "wait" variable, that will call the function regardless | |
*/ | |
// params - fn, @{Callback}, wait @{Integer} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.coffee = false; | |
function Employee1(coffee) { | |
this.coffee = coffee; | |
const enterOffice = () => { | |
if(this.coffee) { | |
console.log('good morning!'); | |
} else { | |
console.log('this sucks'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.coffee = false; | |
function Employee(coffee) { | |
this.coffee = coffee; | |
const enterOffice = function() { | |
if(this.coffee) { | |
console.log('good morning!'); | |
} else { | |
console.log('this sucks'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const debounce = (fn, time) => { | |
let timeout; | |
return function() { | |
const functionCall = () => fn.apply(this, arguments); | |
clearTimeout(timeout); | |
timeout = setTimeout(functionCall, time); | |
} | |
} |