Last active
November 13, 2018 18:45
-
-
Save mearns/22d7c4e65f852b06bc00d31ea4d041ad 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
const dayNamesInOrder = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] | |
const daysOfTheWeek = dayNamesInOrder.reduce((obj, dayName, index) => { | |
obj[dayName] = index | |
return obj | |
}, {}) | |
const studentGradeCache = studentNames.reduce((cache, studentName) => { | |
cache[studentName] = lookupStudentGrade(studentName) | |
return cache | |
}, {}) | |
const perfectSquaresMemo = [ | |
0, 1, 2, 3, 4, 5, 6 | |
].reduce((memo, input) => { | |
memo[input] = input * input | |
return memo | |
}, {}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment