-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchoixQuestions.js
More file actions
39 lines (34 loc) · 967 Bytes
/
choixQuestions.js
File metadata and controls
39 lines (34 loc) · 967 Bytes
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
function getRandomInt (max){
return Math.floor(Math.random()*max)
}
//creation des variables pour les questions randoms
let jRandom
let Question
let jrep1
let jrep2
let jrep3
let jrep4
jRandom = getRandomInt(allQuestions.length)
//attribution des variables pour recup les questions et les réponses
function Dgetques() {
while (allQuestions[jRandom].quizz == 'pris'){
jRandom = getRandomInt(allQuestions.length)
}
if (allQuestions[jRandom].quizz != 'pris'){
Question = allQuestions[jRandom].quizz
jrep1 = allQuestions[jRandom].rep1
jrep2 = allQuestions[jRandom].rep2
jrep3 = allQuestions[jRandom].rep3
jrep4 = allQuestions[jRandom].rep4
if (typeof(jrep3) == 'undefined'){
console.log('jrep3')
jrep3 = ''
}
if (typeof(jrep4) == 'undefined'){
console.log('jrep4')
jrep4 = ''
}
allQuestions[jRandom].quizz='pris'
}
Dbonrep = allQuestions[jRandom].goodrep
}