This file contains 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 isLargerOrEqualTo100 = (a) => { | |
return new Promise((resolve, reject) => { | |
if (a >= 100) { | |
resolve(`${a} is >= 100`) | |
} else { | |
reject(`${a} is < 100`) | |
} | |
}) | |
} |
This file contains 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
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)) |
This file contains 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
/* | |
* 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 |
NewerOlder