We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6fa00e9 commit 9246461Copy full SHA for 9246461
src/models/Cards/index.ts
@@ -64,7 +64,10 @@ export class CardCollection {
64
checkAnswer(id: string, submit: string) {
65
const [card] = this.cardArr.filter((card) => card.id === id);
66
const regex = new RegExp(card.answer, 'i');
67
- regex.test(submit) ? this.#correct(id) : this.#wrong(id);
+
68
+ const isCorrect = regex.test(submit);
69
+ isCorrect ? this.#correct(id) : this.#wrong(id);
70
+ return isCorrect;
71
}
72
73
#correct(id: string) {
@@ -79,6 +82,6 @@ export class CardCollection {
79
82
80
83
81
84
get items() {
- return this.cardArr;
85
+ return structuredClone(this.cardArr);
86
87
0 commit comments