Created
March 6, 2015 14:07
-
-
Save roobie/18d0f04f17df8ed46ce7 to your computer and use it in GitHub Desktop.
key mirror array style
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 aKeyMirror(list) { | |
| var i, key, result = {}; | |
| if (!Array.isArray(list)) { | |
| throw new Error('Argument must be an array.'); | |
| } | |
| for(i = 0; i < list.length; i++) { | |
| key = list[i]; | |
| result[key] = key; | |
| } | |
| return result; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment