Created
July 26, 2017 11:25
-
-
Save h4ckm03d/ab2a8274d6b875a31315cb6baa842dfa to your computer and use it in GitHub Desktop.
This file contains 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 array1 = [{ k: 'v1', v: 2 }, { k: 'v2', v: 2 }, { k: 'v3', v: 2 }] | |
var array2 = {} | |
array1.every(function (elem, idx, array) { | |
array2[elem.k] = elem.v | |
return true | |
}) | |
console.log(array1) | |
console.log(array2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment