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
| 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 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
| console.log(JSON.stringify(objName, null, 2)); |
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
| https://medium.com/stephenkoo/how-to-set-up-create-react-app-redux-react-router-redux-thunk-prettier-scss-airbnb-eslint-dda0bba5616a |
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
| export const selectorName = state => { | |
| return ... | |
| } |
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
| 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 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
| // 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 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
| function descendingOrder(n){ | |
| return parseInt(String(n).split('').sort().reverse().join('')) | |
| } |
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
| function friend(friends){ | |
| return friends.filter(n => n.length === 4) | |
| } |
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
| getMain = (children) => { | |
| return ( | |
| <Switch> | |
| <Route path={pathJoin(this.baseUrl, '/path/one')}> | |
| <main className={styles.something}> | |
| {children} | |
| </main> | |
| </Route> | |
| <Route path={pathJoin(this.baseUrl, '/path/two')}> | |
| <main className={styles.somethingElse}> |
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
| // 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; |