chore: array fill (#8263)

This commit is contained in:
neverland
2021-03-04 14:04:47 +08:00
committed by GitHub
parent 12be46fad8
commit 3fd2972b7c
6 changed files with 19 additions and 36 deletions
+3 -5
View File
@@ -41,12 +41,10 @@ export type IndexBarProvide = {
};
function genAlphabet() {
const indexList = [];
const charCodeOfA = 'A'.charCodeAt(0);
for (let i = 0; i < 26; i++) {
indexList.push(String.fromCharCode(charCodeOfA + i));
}
const indexList = Array(26)
.fill('')
.map((_, i) => String.fromCharCode(charCodeOfA + i));
return indexList;
}