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 getResult(a, b, c) { | |
| return (a + b) * c | |
| } |
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 getResult = function(a, b) { | |
| return function(c) { | |
| return (a + b) * c; | |
| } | |
| } | |
| getResult(2, 3)(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
| const getResult = (a, b) => c => (a + b) * c; | |
| getResult(2, 3)(2); //10 |
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 getResult = function(a, b) { | |
| return function(c) { | |
| return (a + b) * c; | |
| } | |
| } | |
| const sum = getResult(2, 3); | |
| sum(2); // 10 | |
| sum(5); // 25 |
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 getResult = function(a, b) { | |
| return function(c) { | |
| return (a + b) * c; | |
| } | |
| } | |
| getResult(2, 3)(2); //10 |
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 getResult(a, b, c) { | |
| return (a + b) * c; | |
| } | |
| getResult(2, 3, 2); // 10 |
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
| // Data example | |
| const items = [{name: 'Bruce' }, {name: 'Fabs'}, {name: 'Bruce'}, {name: 'Gaby'}]; | |
| /** | |
| * @description Filter by one where condition | |
| * @param w Where condition function | |
| * @returns {Function} filter function | |
| */ | |
| const filter = w => a => a.filter(w); |
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 Car(make, model, year) { | |
| this.make = make; | |
| this.model = model; | |
| this.year = year; | |
| } | |
| function Tesla() { | |
| this.autodrive = true; | |
| } | |
| Car.prototype = new Tesla(); |
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 go(n) { | |
| // n here is defined! | |
| console.log(n); // Object {a: [1,2,3]} | |
| for (let n of n.a) { // ReferenceError | |
| console.log(n); | |
| } | |
| } | |
| go({a: [1, 2, 3]}); |
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
| typeof undeclaredVariable; | |
| typeof newLetVariable; // ReferenceError | |
| typeof newConstVariable; // ReferenceError | |
| typeof newClass; // ReferenceError | |
| let newLetVariable; | |
| const newConstVariable = 'hello'; | |
| class newClass{}; |