-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
72 lines (56 loc) · 2.52 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
let htmlCard = document.querySelector(".card-container")
let htmlQuestion = document.querySelector(".click .question")
let htmlAnswer = document.querySelector(".click .answer")
let next = document.querySelector(".next")
// let questions = []
class Card {
constructor(q,a) {
this.question = q;
this.answer = a;
}
}
let q1 = new Card("Array","A list of JavaScript values. In an array, each value has an index, which is the numbered position of that value in the array. The first value is at index 0, the next value is at index 1, and so on.")
let q2 = new Card("Attribute","A key-value pair in an HTML element. You can use HTML attributes to control certain aspects of an element, like where the element links to or the size of the element.")
// questions.push(q1,q2)
htmlQuestion.text
htmlCard.addEventListener("click", function(evt) {
evt.preventDefault()
htmlQuestion.classList.toggle("hidden")
htmlAnswer.classList.toggle("show")
})
// next.addEventListener("click", function(evt) {
// evt.preventDefault()
// console.log(evt)
// questions and answers
// let questions = {
// "Attribute": "A key-value pair in an HTML element. You can use HTML attributes to control certain aspects of an element, like where the element links to or the size of the element.",
// "Array": "A list of JavaScript values. In an array, each value has an index, which is the numbered position of that value in the array. The first value is at index 0, the next value is at index 1, and so on.",
// "Boolean": "A value that can be either true or false."
// }
// //dont know how im going to use this yet
// // const question = Object.entries(questions)
// // for (let i = 0; i < question.length; i++) {
// // console.log(question[i])
// // }
// // function shuffle(questions){
// // for(var j, x, i = questions.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
// // return questions;
// // };
// // console.log(questions)
// htmlAnswer.textContent = question[0][0]
// //logic for making the card change values
// htmlCard.addEventListener("click", function(evt) {
// evt.preventDefault()
// htmlQuestion.classList.toggle("hidden")
// htmlAnswer.classList.toggle("show")
// htmlAnswer.textContent = question[0][1]
// })
// initial question
// function next() {
// for (var i = 0; i < questions.length; i++) {
// }
// };
// next.addEventListener("click", function(evt) {
// evt.preventDefault()
// console.log(evt)
// // })