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 MyArray () { | |
| console.log("bla"); | |
| Array.call(this); | |
| } | |
| MyArray.prototype = Object.create(Array.prototype) | |
| var x = new MyArray() | |
| x.push("lala") | |
| x.push("lolo") |
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
| begin | |
| headers = values | |
| next | |
| end unless headers |
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
| Array.prototype.unique = function() { | |
| var uniqueKeys = {}, | |
| uniqueArray = [], | |
| items = this.length | |
| while( items ) | |
| uniqueKeys[this[--items]] = true | |
| for( var key in uniqueKeys ) | |
| if (uniqueKeys.hasOwnProperty(key)) uniqueArray.push(key) |