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
| "use strict"; | |
| if (!Array.prototype.reverseOrder) { | |
| Array.prototype.invertir = function() { | |
| var inverted = []; | |
| for (var i = this.length - 1; i >= 0; i--) { | |
| inverted[this.length - (i + 1)] = this[i]; | |
| } | |
| return inverted; | |
| } | |
| } |
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
| "use strict"; | |
| if (Array.prototype.isArray === undefined) { | |
| Array.prototype.isArray = function (value) { | |
| return Object.prototype.toString.apply(value) === "[object Array]"; | |
| }; | |
| } | |
| /* | |
| Examples | |
| */ | |
| Array.isArray({}); //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
| "use strict"; | |
| var add = (function(a){ | |
| return function (b){ | |
| return a + b; | |
| } | |
| }); | |
| var mul = (function(a){ | |
| return function(b){ | |
| var total = a * b; | |
| return total; |
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 factorial(n) { | |
| "use strict"; | |
| var result = 1; | |
| while (n > 1) { | |
| result *= n; | |
| console.log(result); | |
| n -= 1; | |
| } | |
| } |
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
| "use strict"; | |
| function identify(x) { | |
| return function(){ | |
| return x; | |
| } | |
| } | |
| var idf = identify(3); | |
| idf(); // 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
| var add = (function(a) { | |
| return function(b) { | |
| return a + b; | |
| } | |
| }); | |
| var mul = (function(a) { | |
| return function(b) { | |
| var total = a * b; |
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
| var add = (function(a) { | |
| return function(b) { | |
| return a + b; | |
| } | |
| }); | |
| var mul = (function(a) { | |
| return function(b) { | |
| var total = a * b; |
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 add(a,b) { | |
| return (a + b); | |
| } | |
| function methodize(func) { | |
| return function(y){ | |
| return func(this,y); | |
| } | |
| } | |
| Number.prototype.add = methodize(add); | |
| (2).add(3) // 5 |
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 demethodize(func){ | |
| return function(that,y){ | |
| return func.call(that,y); | |
| } | |
| } | |
| var add = (function(a) { | |
| return function(b) { | |
| return a + b; | |
| } | |
| }); |
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
| var add = (function(a) { | |
| return function(b) { | |
| return a + b; | |
| } | |
| }); | |
| var mul = (function(a) { | |
| return function(b) { | |
| var total = a * b; | |
| return total; | |
| } |
OlderNewer