Skip to content

Commit

Permalink
Fixed undefined font error
Browse files Browse the repository at this point in the history
  • Loading branch information
timhaj committed May 1, 2024
1 parent 66882fb commit d499533
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion font.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,14 @@ function handle(selected: any): void {

function generateRandomFonts(): string[] {
let arr: string[] = [];
for (let i: number = 0; arr.length < 5; i++) {
for (let i: number = 0; arr.length < 5;) {
let selected: string = fonts[Math.floor(Math.random() * fonts.length)];
if (arr.indexOf(selected) >= 0) {
continue;
}
else {
arr[i] = selected;
i++;
}
}
return arr;
Expand Down
3 changes: 2 additions & 1 deletion js/font.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,14 @@ function handle(selected) {
}
function generateRandomFonts() {
let arr = [];
for (let i = 0; arr.length < 5; i++) {
for (let i = 0; arr.length < 5;) {
let selected = fonts[Math.floor(Math.random() * fonts.length)];
if (arr.indexOf(selected) >= 0) {
continue;
}
else {
arr[i] = selected;
i++;
}
}
return arr;
Expand Down

0 comments on commit d499533

Please sign in to comment.