Last active
January 19, 2018 10:12
-
-
Save kevinchisholm/9989b2e3662d1f9b1acc5c36ee8a6e2a to your computer and use it in GitHub Desktop.
Code Examples for Blog Post Using fat arrow functions in your Node module
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 tools object | |
var tools = { | |
message: 'Hello from this.message!', | |
asyncTask: function () { | |
//simulate an asynchronous task | |
setTimeout( function () { | |
console.log('THE MESSAGE IS: ' + this.message); | |
}, 1000); | |
} | |
}; | |
//call asyncTask | |
tools.asyncTask(); |
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 tools object | |
var tools = { | |
message: 'Hello from this.message!', | |
asyncTask: function () { | |
//simulate an asynchronous task | |
setTimeout( () => { | |
console.log('THE MESSAGE IS: ' + this.message); | |
}, 1000); | |
} | |
}; | |
//call asyncTask | |
tools.asyncTask(); |
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
someFunction( message => { | |
console.log('THE MESSAGE IS: ' + message); | |
}); | |
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
someFunction( (message1, message2) => { | |
console.log('THE MESSAGE IS: ' + message1 + ' and ' + message2); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment