Last active
March 3, 2018 22:16
-
-
Save uncompiled/afe435958f569561f26d487ee38f067a to your computer and use it in GitHub Desktop.
Replace for loops with map
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
return board.map((row, x) => | |
row.map((_, y) => { | |
let n = getCellNeighborCount(x, y) | |
return (isAlive(x, y) ? n > 1 && n < 4 : n === 3) ? 1 : 0 | |
}) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment