Created
September 5, 2017 14:43
-
-
Save jsumners/cfb7ba6509da7ce968f817ec89cf23b9 to your computer and use it in GitHub Desktop.
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://tc39.github.io/ecma262/#sec-set-constructor | |
| const MyList = class MyList extends Set {} | |
| MyList.fromArray = function (aray) { | |
| const list = new MyList() | |
| array.forEach((a) => list.add(a) | |
| return list | |
| } | |
| MyList.prototype.has = function (ele) { | |
| let result = false | |
| for (const i of this) { | |
| if (i.property === ele) { | |
| result = true | |
| break | |
| } | |
| } | |
| return result | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment