- expression-oriented programming one of the great advances of FP
- expressions plug together like legos, making more malleable programming experience in-the-small
Write in an expression-oriented style, scoping variables as locally as possible:
| console.log(1); | |
| (_ => console.log(2))(); | |
| eval('console.log(3);'); | |
| console.log.call(null, 4); | |
| console.log.apply(null, [5]); | |
| new Function('console.log(6)')(); | |
| Reflect.apply(console.log, null, [7]) | |
| Reflect.construct(function(){console.log(8)}, []); | |
| Function.prototype.apply.call(console.log, null, [9]); | |
| Function.prototype.call.call(console.log, null, 10); |
| Now using node v4.7.2 (npm v2.15.11) | |
| // v8 4.5.103.43 (Node.js 4.7.2) | |
| forVar_______: 2ms | |
| forLet_______: 13ms | |
| forOfVar_____: 66ms | |
| forOfLetConst: 64ms | |
| forEachVar___: 15ms | |
| forEachLet___: 21ms |
| // class | |
| class ClassCar { | |
| drive () { | |
| console.log('Vroom!'); | |
| } | |
| } | |
| const car1 = new ClassCar(); | |
| car1.drive(); |
| // ==UserScript== | |
| // @name Medium: remove location hash | |
| // @namespace http://efcl.info/ | |
| // @description Remove location hash from medium | |
| // @include https://medium.com/*#* | |
| // @version 1 | |
| // @grant none | |
| // ==/UserScript== | |
| function removeLocationHash(){ |