Skip to content

Instantly share code, notes, and snippets.

@JavaTheNutt
JavaTheNutt / testing_async.js
Created September 12, 2017 23:30
Testing async/await blocking
function testPromises() {
Promise.all([someAsynchronousFunction().then(() => {
console.log('first function finished');
}), someOtherAsynchronousFunction().then(() => {
console.log('second finished');
})]).then(() => {
console.timeEnd('testPromises');
})
@JavaTheNutt
JavaTheNutt / Closures.js
Created November 16, 2016 13:33
This is an example of how to use closures for a module pattern in JavaScript
/**
*This function can be thought of as a 'class' to be instantiated
*
*/
function User(){
//private members
var username;
var password;
//constructor