]> git.cworth.org Git - lmno.games/commitdiff
Avoid unnecessary use of fill(null)
authorCarl Worth <cworth@cworth.org>
Thu, 11 Jun 2020 01:04:16 +0000 (18:04 -0700)
committerCarl Worth <cworth@cworth.org>
Thu, 11 Jun 2020 01:04:16 +0000 (18:04 -0700)
Where we can just use a spread-syntax array copy for the same effect,
(namely, ensuring an array has actual items (even if undefined) rather
than "empty" so that map() actually does something).

empathy/empathy.jsx

index 21b766ab689c3c8c652275f16d495387e40faaaa..cd5f3423d845f731e309e5521287a58e68f93c77 100644 (file)
@@ -368,7 +368,7 @@ class ActivePrompt extends React.PureComponent {
         </p>
         <h2>{this.props.prompt.prompt}</h2>
         <form onSubmit={this.handle_submit}>
-          {Array(this.props.prompt.items).fill(null).map((whocares,i) => {
+          {[...Array(this.props.prompt.items)].map((whocares,i) => {
             return (
               <div
                 key={i}