Last active
May 22, 2021 12:58
-
-
Save lpj145/b0fb1b495db8c9f95aa74071019bff83 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const questions = [ | |
'WHats your name ?', | |
'The book is on the table ?', | |
'The car is moving ?', | |
'Is the best or worst driver you see ?' | |
] | |
let currentQuestion = 0 | |
const showQuestion = () => { | |
console.log(questions[currentQuestion]) | |
} | |
const nextQuestion = () => { | |
if (questions.length > 0 && currentQuestion < questions.length) | |
{ | |
currentQuestion += 1 | |
} | |
showQuestion() | |
} | |
const prevQuestion = () => { | |
if (questions.length > 0 && currentQuestion > 0) | |
{ | |
currentQuestion -= 1 | |
} | |
showQuestion() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment