-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
45 lines (42 loc) · 1.19 KB
/
Copy pathapp.js
File metadata and controls
45 lines (42 loc) · 1.19 KB
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
let questions = [
'Age Group Categorization',
'Movie Ticket Pricing',
'Grade Calculator',
'Fruit Ripeness Checker',
'Weather Activity Suggestion',
'Transportation Mode Selection',
'Coffee Customization',
'Password Strength Checker',
'Leap Year Checker',
'Pet Food Recommendation',
'Counting Positive Numbers',
'Sum of Even Numbers',
'Multiplication Table Printer',
'Reverse a String',
'Find the First Non-Repeated Character',
'Factorial Calculator',
'Validate Input',
'Prime Number Checker',
'List Uniqueness Checker',
'Exponential Backoff',
]
console.log(questions[0]);
let allBoxes = document.getElementsByClassName('box')
// console.log(allBoxes);
for( let i = 0 ; i < allBoxes.length ; i++){
allBoxes[i].addEventListener('click',function(){
// console.log(this);
clearAll()
this.style.backgroundColor = 'white'
this.style.color = 'black'
this.style.border = '1px solid black'
this.innerText = questions[Math.floor(Math.random()*20)]
})
}
function clearAll() {
for( let i = 0 ; i < allBoxes.length ; i++){
allBoxes[i].style.backgroundColor = 'black'
allBoxes[i].style.color = 'white'
allBoxes[i].innerText = i + 1
}
}