summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
d041243)
When I first wrote this code I reached for a construct of:
Array(4).map(...)
but I found that map doesn't work on an array of empty items like
this. To get things to work I instead used:
[null, null, null, null].map(...)
which did the trick, but only because I happened to be using a
sufficiently small size that it was reasonable to type the complete
literal. For this commit I've found a cleaner approach of:
Array(4).fill(null).map(...)
- return [null,null,null,null].map(() => LMNO.letters.charAt(Math.floor(Math.random() * LMNO.letters.length))).join('');
+ return Array(4).fill(null).map(() => LMNO.letters.charAt(Math.floor(Math.random() * LMNO.letters.length))).join('');