Browse Source

Add Array.flatMap() polyfill.

feature/save-game
Daniel Perelman 3 years ago
parent
commit
478689278a
2 changed files with 10 additions and 0 deletions
  1. +1
    -0
      www/crossword/index.html
  2. +9
    -0
      www/flatmap.js

+ 1
- 0
www/crossword/index.html View File

@@ -6,6 +6,7 @@
<title>Anagram Crossword</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" type="text/css" href="main.css" />
<script src="../flatmap.js"></script>
<script src="../random.js"></script>
<script src="../scramblestring.js"></script>
<script type="text/javascript" src="../wordlist/typo.js"></script>


+ 9
- 0
www/flatmap.js View File

@@ -0,0 +1,9 @@
'use strict';

if (!Array.prototype.flatMap) {
Object.defineProperty(Array.prototype, 'flatMap', {
value: function(callback) {
return [].concat(...this.map(callback));
}
});
}

Loading…
Cancel
Save