Created
February 13, 2019 16:12
-
-
Save MahmoudAgamy/216f06698c13f01cd52406b23fe80fc5 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
let sortedObj = sortedKeys.reduce((acc,ltr) => { | |
acc[ltr] = obj[ltr] | |
return acc | |
},{}) | |
console.log(sortedObj) // { b: 4, a: 2, c: 2, k: 1 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment