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 doSomething(name) { | |
console.log('hello ' + name); | |
} | |
function loggingDecorator(wrappedFunction) { | |
return function() { | |
console.log('starting'); | |
const result = wrappedFunction.apply(this, arguments); | |
console.log('finished'); | |
return result; |
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
console.log(JSON.stringify(objName, null, 2)); |
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
https://medium.com/stephenkoo/how-to-set-up-create-react-app-redux-react-router-redux-thunk-prettier-scss-airbnb-eslint-dda0bba5616a |
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
export const selectorName = state => { | |
return ... | |
} |
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
https://medium.com/dailyjs/techniques-for-decomposing-react-components-e8a1081ef5da |
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
// ES5 | |
var multiply = function(a, b) { | |
return a * b; | |
}; | |
// ES6 | |
var multiply = (a, b) => { return a * b }; | |
// even neater | |
var multiply = (a, b) => a * b; |
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 keyArray = [ | |
['1'], | |
['A', 'B', 'C', '2'], | |
['D', 'E', 'F', '3'], | |
['G', 'H', 'I', '4'], | |
['J', 'K', 'L', '5'], | |
['M', 'N', 'O', '6'], | |
['P', 'Q', 'R', 'S', '7'], | |
['T', 'U', 'V', '8'], | |
['W', 'X', 'Y', 'Z', '9'], |
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
// A function is only pure if, given the same input, it will always produce the same output. | |
const highpass = (cutoff, value) => value >= cutoff; | |
highpass(5, 123); // true | |
highpass(5, 6); // true | |
highpass(5, 18); // true | |
highpass(5, 5); // true | |
highpass(5, 1); // false | |
highpass(5, 3); // false | |
highpass(5, 4); // false |
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 descendingOrder(n){ | |
return parseInt(String(n).split('').sort().reverse().join('')) | |
} |
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 friend(friends){ | |
return friends.filter(n => n.length === 4) | |
} |