@@ -13,21 +13,21 @@ const addContainer = document.getElementById("add-container");
13
13
let currentActiveCard = 0 ;
14
14
const cardsElement = [ ] ;
15
15
16
- // const cardsData = [
17
- // {
18
- // question: "What does CSS stand for?",
19
- // answer: "Cascading Style Sheets",
20
- // },
21
- // {
22
- // question: "What year was JavaScript launched?",
23
- // answer: "1995",
24
- // },
25
- // {
26
- // question: "What does HTML stand for?",
27
- // answer: "Hypertext Markup Language",
28
- // },
29
- // ];
30
- const cardsData = getCardsData ( ) ;
16
+ const cardsData = [
17
+ {
18
+ question : "What does CSS stand for?" ,
19
+ answer : "Cascading Style Sheets" ,
20
+ } ,
21
+ {
22
+ question : "What year was JavaScript launched?" ,
23
+ answer : "1995" ,
24
+ } ,
25
+ {
26
+ question : "What does HTML stand for?" ,
27
+ answer : "Hypertext Markup Language" ,
28
+ } ,
29
+ ] ;
30
+ // const cardsData = getCardsData();
31
31
32
32
function createCards ( ) {
33
33
cardsData . forEach ( ( data , index ) => createCard ( data , index ) ) ;
@@ -57,15 +57,15 @@ function updateCurrentText() {
57
57
currentElement . innerText = `${ currentActiveCard + 1 } /${ cardsElement . length } ` ;
58
58
}
59
59
60
- function getCardsData ( ) {
61
- const cards = JSON . parse ( localStorage . getItem ( "cards" ) ) ;
62
- return cards === null ? [ ] : cards ;
63
- }
60
+ // function getCardsData() {
61
+ // const cards = JSON.parse(localStorage.getItem("cards"));
62
+ // return cards === null ? [] : cards;
63
+ // }
64
64
65
- function setCardsData ( cards ) {
66
- localStorage . setItem ( "cards" , JSON . stringify ( cards ) ) ;
67
- history . go ( 0 ) ;
68
- }
65
+ // function setCardsData(cards) {
66
+ // localStorage.setItem("cards", JSON.stringify(cards));
67
+ // history.go(0);
68
+ // }
69
69
70
70
// Event Listeners
71
71
nextButton . addEventListener ( "click" , ( ) => {
@@ -103,14 +103,15 @@ addCardButton.addEventListener("click", () => {
103
103
answerElement . value = "" ;
104
104
addContainer . classList . remove ( "show" ) ;
105
105
cardsData . push ( newCard ) ;
106
- setCardsData ( cardsData ) ;
106
+ // setCardsData(cardsData);
107
107
}
108
108
} ) ;
109
109
110
110
clearButton . addEventListener ( "click" , ( ) => {
111
- localStorage . clear ( ) ;
111
+ // localStorage.clear();
112
112
cardsContainer . innerHTML = "" ;
113
- history . go ( 0 ) ;
113
+ currentElement . innerText = "" ;
114
+ // history.go(0);
114
115
} ) ;
115
116
116
117
// Init
0 commit comments