From 435250f319d3564691a682055f86ff3f21aef5ec Mon Sep 17 00:00:00 2001 From: Jakob Krigovsky Date: Fri, 23 Jun 2017 11:29:01 +0200 Subject: [PATCH] Avoid Array.prototype.fill() --- src/components/skins.js | 3 ++- src/utils/frequently.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/skins.js b/src/components/skins.js index 6a2e4eb..2ad24b6 100644 --- a/src/components/skins.js +++ b/src/components/skins.js @@ -29,7 +29,8 @@ export default class Skins extends React.Component { return
- {Array(6).fill().map((_, i) => { + {/* Use Array.prototype.fill() when it is more widely supported. */} + {[...Array(6)].map((_, i) => { var skinTone = i + 1, selected = skinTone == skin diff --git a/src/utils/frequently.js b/src/utils/frequently.js index e4e41c1..d1fb696 100644 --- a/src/utils/frequently.js +++ b/src/utils/frequently.js @@ -37,7 +37,8 @@ function get(perLine) { if (!frequently) { defaults = {} - return Array(perLine).fill('').map((_, i) => { + // Use Array.prototype.fill() when it is more widely supported. + return [...Array(perLine)].map((_, i) => { defaults[DEFAULTS[i]] = perLine - i return DEFAULTS[i] })