Skip to content

Instantly share code, notes, and snippets.

View minmaxdata's full-sized avatar
🐕

Ke McAdams minmaxdata

🐕
  • 18:53 (UTC -07:00)
View GitHub Profile
@minmaxdata
minmaxdata / async-await.js
Created August 4, 2018 22:52 — forked from iHani/async-await.js
async await basic example.
const isLargerOrEqualTo100 = (a) => {
return new Promise((resolve, reject) => {
if (a >= 100) {
resolve(`${a} is >= 100`)
} else {
reject(`${a} is < 100`)
}
})
}
@minmaxdata
minmaxdata / Currying.js
Created August 4, 2018 22:52 — forked from iHani/Currying.js
Currying (also partial application)
function person (name) {
return function age (age) {
return `${name} is ${age}`
}
}
// if we called
const arg1 = 'Richard'
const arg2 = 30
console.log(person(arg1)(arg2))
@minmaxdata
minmaxdata / SpreadOperator.js
Created April 3, 2018 20:34 — forked from iHani/SpreadOperator.js
Spread Operator
/*
* Array spread operator
*/
const arr = [1, 3, 5]
arr.concat(7)
// [1, 3, 5, 7] // returns a new array, doesn't change arr
arr.push(11)
// [1, 3, 5, 11] // actually changes arr